AWS Serverless Application Model (SAM) Flashcards

1
Q

In a SAM template, what AWS resource type would you be using when running lambda, dynamoDB or API Gatway?

A

AWS::Serverless::Function is used for running lambda functions in SAM
AWS::Serverless::SimpleTable for DynamoDB and
AWS::Serverless::Api for API Gway

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

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?

A

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 well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How are SAM applications packaged and deployed?

A

sam package and sam deploy cli commands will package and deploy a SAM application. These are aliases for aws cloudformation package and deploy

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

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?

A

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

How well did you know this?
1
Not at all
2
3
4
5
Perfectly