Courseiva
Deployment →mediumMultiple Choice

DVA-C02 Deployment Practice Question

A developer is deploying a serverless application using AWS SAM. The developer runs 'sam deploy' but receives an error that the S3 bucket does not exist. How should the developer fix this?

⚠ Common exam trap

DVA-C02 often tests the difference between sam build, sam package, sam deploy, and sam publish — the trap is assuming sam package or sam build creates the S3 bucket, when only an explicit bucket creation or --s3-bucket specification resolves the error.

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

✓

Create an S3 bucket and specify it with --s3-bucket.

AWS SAM requires an S3 bucket to store the packaged application artifacts (Lambda code, nested stacks) during deployment. If the bucket specified (or the default SAM-managed bucket) does not exist, the developer must create an S3 bucket and pass it via the --s3-bucket parameter to sam deploy.

Answer analysis

Option-by-option breakdown

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

  • ✗

    Use sam publish to deploy the application.

    Why it's wrong here

    sam publish uploads a packaged application to the AWS Serverless Application Repository so other accounts can discover and deploy it; it is unrelated to creating or specifying a deployment artifact bucket and does not address the missing bucket error at all.

  • ✗

    Run sam build to generate the bucket.

    Why it's wrong here

    sam build only compiles and stages Lambda function dependencies and code into a local .aws-sam directory for later packaging; it performs no AWS API calls to create infrastructure like S3 buckets, so it cannot resolve a missing-bucket error at deploy time.

  • ✓

    Create an S3 bucket and specify it with --s3-bucket.

    Why this is correct

    AWS SAM CLI does not automatically provision the S3 bucket used to stage CloudFormation deployment artifacts (unless using the guided deploy flow's managed bucket); the developer must create the bucket first and pass its name via --s3-bucket, or run sam deploy --guided to have SAM create and remember one.

  • ✗

    Run sam package to create the bucket automatically.

    Why it's wrong here

    sam package transforms the local template by uploading artifacts to an S3 bucket and rewriting the template's local references into S3 URIs, but it requires that the target bucket already exist and be passed as a parameter — it does not create the bucket on the developer's behalf.

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

Courseiva writes every DVA-C02 question from scratch — 1,135 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 and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Amazon Web Services exam blueprint

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.