DVA-C02 Development with AWS Services Practice Question
A developer is deploying a serverless application using the AWS Serverless Application Model (SAM). The application consists of an API Gateway, Lambda functions, and a DynamoDB table. The developer wants to define and deploy this infrastructure as code. Which files and tools are required? (Choose THREE.)
⚠ Common exam trap
The trap here is that candidates might think only the SAM template file is enough, but they overlook that the `package` and `deploy` commands are essential to upload artifacts and orchestrate the CloudFormation stack deployment.
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
✓
aws cloudformation deploy command
The AWS SAM template file (template.yaml) is required to define the serverless application resources. The `aws cloudformation package` command uploads local artifacts (such as Lambda deployment packages) to an S3 bucket and returns a copy of the template with references to the S3 object locations. The `aws cloudformation deploy` command then provisions the stack using the processed template. Together, these three are essential for deploying a SAM application using CloudFormation commands. While SAM CLI provides convenient wrappers like `sam package` and `sam deploy`, the underlying CloudFormation commands can also be used directly.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Terraform configuration files
Why it's wrong here
Terraform configuration files (`.tf`) are used with HashiCorp Terraform, an infrastructure-as-code tool that operates independently of the AWS Serverless Application Model (SAM) toolchain. While Terraform can provision AWS resources, it does not natively interpret or process AWS SAM template syntax. A developer deploying a serverless application *using SAM* would exclusively utilize SAM templates and the AWS CLI/SAM CLI commands, not Terraform.
- ✓
aws cloudformation deploy command
Why this is correct
The `aws cloudformation deploy` command is the final step in deploying a serverless application defined by an AWS SAM template. It takes the packaged CloudFormation template (which references artifacts uploaded to S3) and creates or updates the entire serverless application stack, including Lambda functions, API Gateway endpoints, and DynamoDB tables, ensuring all resources are provisioned and configured according to the template's specifications.
- ✓
AWS SAM template file (template.yaml)
Why this is correct
The AWS Serverless Application Model (SAM) template file, typically named `template.yaml`, serves as the declarative blueprint for a serverless application. It is an extension of AWS CloudFormation that provides a simplified, developer-friendly syntax for defining common serverless resources such as Lambda functions, API Gateway APIs, and DynamoDB tables, along with their event sources, permissions, and other configurations.
- ✓
aws cloudformation package command
Why this is correct
The `aws cloudformation package` command is a critical intermediate step in the SAM deployment workflow. It processes the local serverless application artifacts, such as Lambda function code or layers, zips them, uploads them to a specified Amazon S3 bucket, and then transforms the SAM template. This transformation replaces local code paths with the S3 object URLs, creating a deployable CloudFormation template ready for the `aws cloudformation deploy` command.
- ✗
AWS CLI with aws lambda update-function-code command
Why it's wrong here
The `aws lambda update-function-code` command is designed to update the code for a *single, existing* AWS Lambda function. It is insufficient for deploying an entire serverless application, which typically involves multiple interconnected resources like API Gateway endpoints, DynamoDB tables, and IAM roles, in addition to Lambda functions. This command lacks the capability to manage the complete lifecycle and interdependencies of a full application stack.
Quick reference
AWS S3 Storage Class Comparison
| Storage Class | Min Duration | Retrieval | Use Case |
|---|---|---|---|
| S3 Standard | None | Immediate | Frequently accessed data |
| S3 Standard-IA | 30 days | Immediate | Infrequent access, rapid retrieval |
| S3 One Zone-IA | 30 days | Immediate | Non-critical infrequent data |
| S3 Intelligent-Tiering | None | Immediate–hours | Unknown or changing access patterns |
| S3 Glacier Instant | 90 days | Milliseconds | Archive with instant retrieval |
| S3 Glacier Flexible | 90 days | Minutes–hours | Archive, flexible retrieval |
| S3 Glacier Deep Archive | 180 days | Hours | Long-term compliance archive |
Go deeper
Related to this question
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 →
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.