

So in the case of a CPU-intensive function, it might be required to increase MemorySize, even if the function doesn't need that much memory.ĬodeUri defines the location of the function code. It's important to know, that AWS assigns CPU resources proportionally to MemorySize. MemorySize defines the size of the assigned memory in MB.
#Aws cloudformation dynamodb table example code#
Timeout defines how long the execution of the code may take at most before AWS terminates the execution. Runtime defines how the function was implemented, which is Java 8 in our case. As we are using Java, it is the class name including the package, in connection with the method name.

Handler defines the logic of the function. Handler: .APIDemoHandler::handleGetByParamĪs we can see, each function has the same properties: Handler: .APIDemoHandler::handleRequestĬodeUri. Next, let's define our two functions: AWSTemplateFormatVersion: '' The SAM specification currently supports three types: AWS::Serverless::Api, AWS::Serverless::Function as well as AWS::Serverless::SimpleTable.Īs we want to deploy our example application, we have to define one SimpleTable, two Functions, as well as one Api in our template-body. The body consists of a set of resources: each resource has a name, a resource Type, and a set of Properties. The header specifies the version of the CloudFormation template ( AWSTemplateFormatVersion) as well as the version of our SAM template ( Transform). First, let's have a look at the overall structure of our template: AWSTemplateFormatVersion: ''ĭescription: Baeldung Serverless Application Model exampleĪs we can see, the template consists of a header and a body:
