Understanding the SAM template

The following is a YAML source for the SAM template we downloaded (from the export function option) for the Lambda function defined in the previous section:

AWSTemplateFormatVersion: '2010-09-09'
Transform: 'AWS::Serverless-2016-10-31'
Description: A starter AWS Lambda function.
Resources:
TestLambdaBluePrint:
Type: 'AWS::Serverless::Function'
Properties:
Handler: lambda_function.lambda_handler
Runtime: python3.6
CodeUri: .
Description: A starter AWS Lambda function.
MemorySize: 128
Timeout: 3
Role: 'arn:aws:iam::450394462648:role/LamdaFullAccess'
Tags:
'lambda-console:blueprint': hello-world-python3

You have a Lambda function defined here. Below that you are defining a couple of Lambda function properties, including a link to the code, the handler, the runtime, and some IAM policies that the function is going to assume. Below that we would define the event source (we did not select a specific event source in our example). If we were using the API Gateway, then we need not explicitly define the API here – the event source definition is sufficient for CloudFormation to provision that API in your account.

The Transform line tells CloudFormation to take this template and transform it into a full-blown CloudFormation template under the covers. CloudFormation will use this template to provision the resources in the AWS account. Typically, the resources that get provisioned here include the Lambda function, a couple of IAM resources, some API Gateway resources, and so on. The full-blown CloudFormation template that is generated is complicated and voluminous compared to the SAM.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.15.3.136