nerdexam
Amazon

DVA-C02 · Question #459

A developer is creating a script to automate the deployment process for a serverless application. The developer wants to use an existing AWS Serverless Application Model (AWS SAM) template for the…

The correct answer is A. Call aws cloudformation package to create the deployment package. Call aws cloudformation B. Call sam package to create the deployment package. Call sam deploy to deploy the package. Both A and B represent valid two-step workflows for deploying an AWS SAM application: package first (transform the SAM template and upload local artifacts to S3), then deploy (execute the CloudFormation changeset). Option A uses the CloudFormation CLI equivalents (aws…

Submitted by haruto_sh· Mar 5, 2026Deployment

Question

A developer is creating a script to automate the deployment process for a serverless application. The developer wants to use an existing AWS Serverless Application Model (AWS SAM) template for the application. What should the developer use for the project? (Choose two.)

Options

  • ACall aws cloudformation package to create the deployment package. Call aws cloudformation
  • BCall sam package to create the deployment package. Call sam deploy to deploy the package
  • CCall aws s3 cp to upload the AWS SAM template to Amazon S3. Call aws lambda update-
  • DCreate a ZIP package locally and call aws serverlessrepo create-applicatiion to create the
  • ECreate a ZIP package and upload it to Amazon S3. Call aws cloudformation create-stack to

How the community answered

(35 responses)
  • A
    71% (25)
  • C
    17% (6)
  • D
    3% (1)
  • E
    9% (3)

Explanation

Both A and B represent valid two-step workflows for deploying an AWS SAM application: package first (transform the SAM template and upload local artifacts to S3), then deploy (execute the CloudFormation changeset). Option A uses the CloudFormation CLI equivalents (aws cloudformation package / aws cloudformation deploy), while Option B uses the native SAM CLI commands (sam package / sam deploy) - both are officially supported paths because SAM templates are a superset of CloudFormation.

Why the distractors fail:

  • C (aws s3 cp + aws lambda update-*) manually pushes a file to S3 and updates a single Lambda function - it bypasses SAM/CloudFormation entirely and can't orchestrate a full serverless stack.
  • D (aws serverlessrepo create-application) publishes an app to the AWS Serverless Application Repository for others to discover and reuse - it's not a deployment command for your own environment.
  • E (ZIP + aws cloudformation create-stack) skips the package step, which is required to transform SAM-specific resource types (like AWS::Serverless::Function) into valid CloudFormation resources; calling create-stack directly on an unprocessed SAM template will fail.

Memory tip: Think "Package → Deploy" as the mandatory two-step rhythm. Both the SAM CLI (sam) and the CloudFormation CLI (aws cloudformation) support this same rhythm - knowing either tool satisfies the question.

Topics

#AWS SAM#Deployment Automation#AWS CLI#CloudFormation

Community Discussion

No community discussion yet for this question.

Full DVA-C02 Practice