AWS Serverless Application Model (SAM) Flashcards
In a SAM template, what AWS resource type would you be using when running lambda, dynamoDB or API Gatway?
AWS::Serverless::Function is used for running lambda functions in SAM
AWS::Serverless::SimpleTable for DynamoDB and
AWS::Serverless::Api for API Gway
You have a cloud formation template which contains the line
Transform:’AWS::Serverless-2016-10-31’ in the template header. What is this template and how will it differ from a CF template?
This is a SAM template. This will allow you deploy an entire cloud formation stack using just the
aws cloudformation package
and
aws cloudformation deploy
How are SAM applications packaged and deployed?
sam package and sam deploy cli commands will package and deploy a SAM application. These are aliases for aws cloudformation package and deploy
We have a SAM stack ready to be deployed using cloud formation. We have run the cloudformation package commands correctly with our template.yaml and it looks to have generate the correct output - template-generated.yaml file for running the deploy. The deploy command generate by CloudFormation is:
aws cloudformation deploy –template-file gen/template-generated.yaml –stack-name hello-world-sam2
When we run this though, we get the following error:
“FAILED” Status: FAILED. Reason: Requires capabilities : [CAPABILITY_IAM]
Why?
When you’re creating or deploying a stack you need to explicitly allow creation of IAM resources. To do that, you need to add the parameter –capabilities CAPABILITY_IAM