DVA-C02 · Question #432
A developer has built an application running on AWS Lambda using AWS Serverless Application Model (AWS SAM). What is the correct sequence of steps to successfully deploy the application?
The correct answer is B. 1. Build the SAM template locally.. The correct AWS SAM deployment sequence is to build the template locally, then package the artifacts to S3, and finally deploy using CloudFormation.
Question
A developer has built an application running on AWS Lambda using AWS Serverless Application Model (AWS SAM). What is the correct sequence of steps to successfully deploy the application?
Options
- A
- Build the SAM template in Amazon EC2.
- B
- Build the SAM template locally.
- C
- Build the SAM template locally.
- D
- Build the SAM template locally.
How the community answered
(52 responses)- A2% (1)
- B88% (46)
- C4% (2)
- D6% (3)
Why each option
The correct AWS SAM deployment sequence is to build the template locally, then package the artifacts to S3, and finally deploy using CloudFormation.
Building the SAM template on Amazon EC2 is unnecessary and adds infrastructure overhead; the SAM CLI is designed to run locally and does not require an EC2 instance for the build step.
The SAM CLI workflow starts with sam build locally to compile code and resolve dependencies, followed by sam package (or sam deploy --guided) to upload artifacts to S3 and produce a transformed CloudFormation template, and then sam deploy to create or update the CloudFormation stack. Building locally ensures dependencies are resolved in the correct runtime environment before packaging.
This option likely reverses or omits a required step in the sequence (such as packaging before deploying), which would cause the deployment to fail because artifacts have not been uploaded to S3.
This option likely specifies an incorrect or incomplete sequence, such as skipping the package step or deploying before building, which would result in a failed or incomplete deployment.
Concept tested: AWS SAM CLI deployment sequence: build, package, deploy
Source: https://docs.aws.amazon.com/serverless-application-model/latest/developerguide/sam-cli-command-reference-sam-deploy.html
Community Discussion
No community discussion yet for this question.