Courseiva
DeploymenteasyMultiple ChoiceObjective-mapped

DVA-C02 Deployment Practice Question

A developer uses AWS SAM (Serverless Application Model) to define a serverless application. The developer wants to run the application locally for testing. Which AWS SAM CLI command should be used?

⚠ Common exam trap

Many exam-takers confuse `sam build` or `sam package` as commands that also run the application locally, but these commands are solely for packaging and deployment preparation, not for local execution.

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 local start-api

`sam local start-api` starts a local HTTP server that emulates the API Gateway endpoint and invokes your Lambda functions defined in the SAM template. This allows you to test API requests and responses locally without deploying to AWS, making it the appropriate command for local testing of a serverless application.

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 local start-api

    Why this is correct

    This command is specifically designed for local development and testing of serverless applications defined by AWS SAM. It emulates the API Gateway service on your local machine, creating HTTP endpoints that route requests to your Lambda functions running in a Docker container. This allows developers to test their API endpoints and Lambda logic without deploying to the AWS cloud, significantly accelerating the development cycle.

  • sam build

    Why it's wrong here

    The `sam build` command is used to process your application's source code and dependencies, preparing it for deployment. It compiles code, installs dependencies, and creates deployment artifacts (e.g., ZIP files for Lambda functions) within a `.aws-sam/build` directory. While essential for creating deployable packages, this command does not execute or run the application locally or in the cloud; it only prepares the artifacts.

  • sam deploy

    Why it's wrong here

    The `sam deploy` command is responsible for deploying your serverless application to the AWS cloud. It leverages AWS CloudFormation to provision and update the necessary AWS resources, such as Lambda functions, API Gateway endpoints, and DynamoDB tables, based on your SAM template. This command is for actual cloud deployments and does not facilitate local testing or execution of the application.

  • sam package

    Why it's wrong here

    The `sam package` command prepares your serverless application for deployment by uploading local artifacts, such as Lambda function code or layer content, to an S3 bucket. It then generates a new SAM template with S3 URIs pointing to these uploaded artifacts, making the template ready for a `sam deploy` operation. This command is a preparatory step for cloud deployment and does not involve local execution or testing of the application.

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

Courseiva writes every DVA-C02 question from scratch — 724 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or 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.