Question 44 of 724
DVA-C02 Deployment Practice Question
A developer is deploying a serverless application using the AWS Serverless Application Model (SAM). The application consists of an API Gateway, a Lambda function, and a DynamoDB table. The developer wants to enable canary deployments for the Lambda function. What should the developer do?
⚠ Common exam trap
Many candidates think they need to manually create a Lambda alias or use CodePipeline for canary deployments, when in fact SAM's `AutoPublishAlias` and `DeploymentPreference` properties automate the entire canary deployment workflow via CodeDeploy.
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
✓
Add the AutoPublishAlias and DeploymentPreference properties to the Lambda function in the SAM template.
The AWS SAM template supports canary deployments for Lambda functions by adding the `AutoPublishAlias` property (which automatically creates and publishes a new version to a Lambda alias) and the `DeploymentPreference` property (which defines the traffic-shifting strategy, such as `Canary10Percent5Minutes`). This enables CodeDeploy to gradually shift traffic from the current version to the new version without manual intervention.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✗
Configure a CodeDeploy deployment group in the SAM template.
Why it's wrong here
While AWS CodeDeploy is the underlying service that performs the traffic shifting for SAM's canary deployments, a developer does not directly configure a CodeDeploy DeploymentGroup resource in the SAM template. Instead, SAM abstracts this by using specific Lambda function properties, such as DeploymentPreference, which then instruct SAM to provision and manage the necessary CodeDeploy resources automatically. Directly defining a CodeDeploy DeploymentGroup is not the standard or correct approach for enabling SAM's built-in canary deployments.
- ✗
Create a Lambda alias and configure traffic shifting manually.
Why it's wrong here
Manually creating a Lambda alias and then configuring traffic shifting through the AWS console or CLI would bypass the significant automation provided by SAM. SAM's AutoPublishAlias and DeploymentPreference properties are specifically designed to automate the creation of aliases, the publishing of new Lambda versions, and the controlled traffic shifting between versions, eliminating the need for manual intervention during deployment. This manual approach defeats the purpose of using SAM for streamlined, automated canary deployments.
- ✓
Add the AutoPublishAlias and DeploymentPreference properties to the Lambda function in the SAM template.
Why this is correct
This is the correct and most efficient method for enabling canary deployments with SAM. The AutoPublishAlias property in a SAM Lambda function resource automatically creates a new Lambda version and an alias pointing to it upon deployment, facilitating robust version management. The DeploymentPreference property then configures the traffic shifting strategy, including options for canary or linear deployments, automated rollback alarms, and pre/post-traffic hooks, all orchestrated by AWS CodeDeploy under the hood, enabling fully automated canary deployments.
- ✗
Use AWS CodePipeline to orchestrate the canary deployment.
Why it's wrong here
AWS CodePipeline is a continuous delivery service used to automate entire release pipelines, which can include building, testing, and deploying applications. While CodePipeline can certainly be used to orchestrate the *entire* deployment process for a SAM application, it is not a prerequisite or the direct mechanism for enabling the *canary deployment itself* within SAM. SAM's built-in canary deployment capabilities, configured via DeploymentPreference, function independently of CodePipeline, handling the traffic shifting logic directly through CloudFormation and CodeDeploy.
Quick reference
Cloud Service Model Comparison
| Model | You Manage | Provider Manages | Examples |
|---|---|---|---|
| IaaS | OS, runtime, apps, data | Hardware, hypervisor, networking | EC2, Azure VMs, GCP Compute Engine |
| PaaS | Apps and data | OS, runtime, middleware, hardware | Elastic Beanstalk, Azure App Service |
| SaaS | Data and settings only | Everything else | Microsoft 365, Salesforce, Workday |
| FaaS / Serverless | Function code only | Infra, scaling, runtime | Lambda, Azure Functions, Cloud Run |
| CaaS | Containers and apps | Kubernetes, OS, hardware | EKS, AKS, GKE |
About these practice questions
Courseiva creates original exam-style practice questions with explanations and wrong-answer analysis. It does not publish real exam questions, exam dumps, or protected exam content. Learn why practice questions differ from exam dumps →
Last reviewed: Jun 24, 2026
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.
Question Discussion
Share a tip, memory trick, or ask about the reasoning behind this question. Do not post real exam questions, leaked content, braindumps, or copyrighted exam material. Comments are moderated and may be removed without notice.
Sign in to join the discussion.