Courseiva
Deployment →easyMultiple Select

DVA-C02 Deployment Practice Question

A developer is deploying a serverless application using AWS SAM. The application includes multiple Lambda functions and an API Gateway. Which THREE AWS CLI commands are part of the typical SAM deployment workflow? (Choose THREE.)

⚠ Common exam trap

Test-takers frequently confuse `sam init` (a project scaffolding command) with a deployment step, or mistakenly think `aws s3 cp` is part of the SAM workflow when in fact SAM provides its own `sam package` command to handle S3 uploads and template transformation.

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

✓

sam deploy

`sam deploy` is the AWS SAM CLI command that deploys the packaged application to AWS, creating or updating the CloudFormation stack with the Lambda functions and API Gateway resources. It reads the `template.yaml` and the packaged artifacts (from `sam package`) to provision the infrastructure. This command is the final step in the standard SAM deployment workflow.

Answer analysis

Option-by-option breakdown

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

  • ✓

    sam deploy

    Why this is correct

    The sam deploy command is the final and most comprehensive step in the AWS SAM CLI workflow for deploying a serverless application. It takes the built and packaged artifacts, along with the transformed SAM template, and uses AWS CloudFormation to create or update the necessary AWS resources, such as Lambda functions, API Gateway endpoints, and DynamoDB tables, in the specified AWS account and region. This command orchestrates the entire resource provisioning and update process.

  • ✗

    sam init

    Why it's wrong here

    The sam init command is specifically designed for initializing a new serverless application project, not for deployment. It creates a directory structure, a basic SAM template, and example code for a chosen runtime, providing a foundational starting point for development. Its sole purpose is project scaffolding, setting up the initial files and configuration.

  • ✓

    sam package

    Why this is correct

    The sam package command prepares your serverless application for deployment by zipping your code and dependencies, then uploading these deployment artifacts to an Amazon S3 bucket. It also transforms the local SAM template into a CloudFormation-compatible template, replacing local paths with S3 object URLs, which is crucial for CloudFormation to locate the deployment assets during the subsequent sam deploy step.

  • ✓

    sam build

    Why this is correct

    The sam build command compiles your application code and its dependencies, creating a deployment-ready artifact in the .aws-sam/build directory. For runtimes like Node.js or Python, this might involve installing dependencies into a specific directory structure. For compiled languages like Java or Go, it executes the necessary compilation steps, ensuring that the final output is suitable for packaging and deployment to AWS Lambda.

  • ✗

    aws s3 cp

    Why it's wrong here

    The aws s3 cp command is a general-purpose AWS CLI command used for copying files and directories to and from Amazon S3 buckets. While SAM internally uses S3 for storing deployment artifacts, directly using aws s3 cp bypasses the critical template transformation and resource provisioning logic handled by sam package and sam deploy, making it unsuitable for deploying a serverless application defined by a SAM template.

Quick reference

Cloud Service Model Comparison

ModelYou ManageProvider ManagesExamples
IaaSOS, runtime, apps, dataHardware, hypervisor, networkingEC2, Azure VMs, GCP Compute Engine
PaaSApps and dataOS, runtime, middleware, hardwareElastic Beanstalk, Azure App Service
SaaSData and settings onlyEverything elseMicrosoft 365, Salesforce, Workday
FaaS / ServerlessFunction code onlyInfra, scaling, runtimeLambda, Azure Functions, Cloud Run
CaaSContainers and appsKubernetes, OS, hardwareEKS, AKS, GKE

About these practice questions

One of 1,135 original DVA-C02 practice questions on Courseiva, each with a full explanation and wrong-answer analysis — not exam dumps or protected exam content. 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.