Courseiva
DeploymentmediumMultiple SelectObjective-mapped

DVA-C02 Deployment Practice Question

Which THREE steps should a developer include in a CI/CD pipeline to deploy a serverless application using AWS SAM? (Choose three.)

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

Run 'sam build' to prepare the application

In a typical SAM CI/CD pipeline, the three essential steps are: (A) running 'sam build' to prepare the application, (E) running 'sam package' to upload the build artifacts to an S3 bucket, and (C) running 'sam deploy' to create or update the CloudFormation stack. Option B is incorrect because manually configuring API Gateway stages is not a standard automated step in a CI/CD pipeline; SAM manages API Gateway configurations as part of the deployment. Option D is incorrect because 'aws lambda update-alias' is not a typical step in a SAM deployment; traffic shifting can be handled via SAM's deployment preferences.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • Run 'sam build' to prepare the application

    Why this is correct

    Correct. `sam build` is the first step in a SAM-based CI/CD pipeline. It compiles your source code, installs dependencies listed in `requirements.txt`, `package.json`, or similar manifests, and stages the runnable code under `.aws-sam/build`. It also rewrites the AWS SAM template to replace local artifact paths with the built-artifact locations, so downstream commands have a reproducible deployable bundle to consume.

  • Manually configure API Gateway stages

    Why it's wrong here

    Incorrect. API Gateway stages are declared directly in the AWS SAM template via `Globals.Api.StageName` or API events, and CloudFormation creates and updates them automatically during `sam deploy`. Manually configuring stages in the API Gateway console is redundant, introduces drift between your infrastructure-as-code template and the live environment, and could be overwritten on the very next stack update, making the pipeline non-deterministic and difficult to audit.

  • Run 'sam deploy' to create or update the CloudFormation stack

    Why this is correct

    Correct. `sam deploy` executes a CloudFormation stack update or creation for the SAM template, provisioning all resources including Lambda functions, API Gateway, IAM roles, and event sources. It computes a change set, gets approval if required, and then applies the changes; in a CI/CD pipeline this is the final deployment action that brings the built and packaged application into the target environment.

  • Run 'aws lambda update-alias' to shift traffic

    Why it's wrong here

    Incorrect. `aws lambda update-alias` is an ad-hoc command for shifting traffic between Lambda versions, usually after a deployment has already occurred. In a SAM pipeline, traffic shifting is configured declaratively with `DeploymentPreference` on the `AWS::Serverless::Function` resource, and AWS CodeDeploy handles the canary or linear routing automatically. Calling `update-alias` manually in the pipeline bypasses CodeDeploy hooks, makes rollbacks more complex, and is not a recognized step in the SAM build/package/deploy workflow.

  • Run 'sam package' to upload artifacts to S3

    Why this is correct

    Correct. `sam package` uploads the artifacts generated by `sam build` to a specified Amazon S3 bucket and outputs a packaged template with local file paths replaced by the corresponding S3 URIs. This step is essential in classic SAM pipelines because CloudFormation must fetch the Lambda code and layer bundles from S3 during deployment; it also gives you a clear, versioned artifact location and makes the packaged template portable across accounts and environments.

Quick reference

AWS S3 Storage Class Comparison

Storage ClassMin DurationRetrievalUse Case
S3 StandardNoneImmediateFrequently accessed data
S3 Standard-IA30 daysImmediateInfrequent access, rapid retrieval
S3 One Zone-IA30 daysImmediateNon-critical infrequent data
S3 Intelligent-TieringNoneImmediate–hoursUnknown or changing access patterns
S3 Glacier Instant90 daysMillisecondsArchive with instant retrieval
S3 Glacier Flexible90 daysMinutes–hoursArchive, flexible retrieval
S3 Glacier Deep Archive180 daysHoursLong-term compliance archive

About these practice questions

This DVA-C02 question is part of Courseiva's 724-question bank — original exam-style content with full explanations and wrong-answer analysis, never real exam questions or exam dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

This DVA-C02 practice question is part of Courseiva's free Amazon Web Services certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the DVA-C02 exam.