- A
DeploymentPreference
The DeploymentPreference attribute in SAM is used to define traffic shifting and canary deployment settings for Lambda and API Gateway.
- B
CanarySetting
Why wrong: CanarySetting is a sub-property of DeploymentPreference, not a top-level attribute in SAM. It specifies the canary configuration within deployment preferences.
- C
StageName
Why wrong: StageName is used to name the API Gateway stage, not to configure deployment strategies.
- D
MethodSettings
Why wrong: MethodSettings is used to configure API Gateway settings like caching and throttling for individual methods, not traffic shifting.
Quick Answer
The answer is the `DeploymentPreference` attribute on the `AWS::Serverless::Api` resource. This attribute is correct because it directly integrates AWS SAM with AWS CodeDeploy to manage canary deployments for API Gateway, allowing you to gradually shift traffic to a new stage version using patterns like `Canary10Percent5Minutes`. It also supports automatic rollbacks via CloudWatch Alarms, making it a fully managed solution for safe, incremental releases. On the AWS Certified Developer Associate DVA-C02 exam, this tests your understanding of how SAM abstracts CodeDeploy’s deployment configuration into a simple YAML attribute—a common trap is confusing it with `AutoPublishAlias` (used for Lambda functions) or assuming you must manually create a CodeDeploy application. Remember the memory tip: “SAM’s DeploymentPreference is the canary in the API coal mine”—if you see gradual traffic shifting for API Gateway in a SAM template, that attribute is your answer.
DVA-C02 Deployment Practice Question
This DVA-C02 practice question tests your understanding of deployment. This is a configuration task: choose the command set that satisfies every stated requirement. Small differences — like 'secret' vs 'password' or 'transport input ssh' vs 'all' — change whether the answer is correct. A key principle to apply: deploymentPreference is a property of AWS::Serverless::Function in SAM.. Once you have made your selection, read the full explanation to reinforce the concept and understand why each distractor is designed to mislead on exam day.
A developer is deploying a serverless application using AWS SAM. The application consists of multiple Lambda functions and an Amazon API Gateway. The developer wants to enable canary deployments for the API Gateway stage to gradually shift traffic. Which SAM resource attribute should the developer use?
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
DeploymentPreference
Option A is correct because the `DeploymentPreference` attribute in AWS SAM's `AWS::Serverless::Api` resource enables canary deployments for API Gateway stages. This attribute allows you to configure traffic shifting patterns, such as linear or canary, by specifying settings like `Type` (e.g., `Canary10Percent5Minutes`) and `Alarms` to automatically roll back on failures. It directly integrates with AWS CodeDeploy to manage the gradual traffic shift without manual intervention.
Key principle: DeploymentPreference is a property of AWS::Serverless::Function in SAM.
Answer analysis
Option-by-option breakdown
For each option: why learners choose it and why it is or isn't the right answer here.
- ✓
DeploymentPreference
Why this is correct
The DeploymentPreference attribute in SAM is used to define traffic shifting and canary deployment settings for Lambda and API Gateway.
Related concept
DeploymentPreference is a property of AWS::Serverless::Function in SAM.
- ✗
CanarySetting
Why it's wrong here
CanarySetting is a sub-property of DeploymentPreference, not a top-level attribute in SAM. It specifies the canary configuration within deployment preferences.
- ✗
StageName
Why it's wrong here
StageName is used to name the API Gateway stage, not to configure deployment strategies.
- ✗
MethodSettings
Why it's wrong here
MethodSettings is used to configure API Gateway settings like caching and throttling for individual methods, not traffic shifting.
Common exam traps
Common exam trap: answer the scenario, not the keyword
The trap here is that candidates confuse `CanarySetting` (a direct CloudFormation property for API Gateway stages) with the SAM-specific `DeploymentPreference` attribute, which is the correct abstraction for canary deployments in SAM templates.
Detailed technical explanation
How to think about this question
Under the hood, SAM's `DeploymentPreference` attribute creates an AWS CodeDeploy application and deployment group, which uses the `Canary10Percent5Minutes` traffic shifting configuration to shift 10% of traffic to the new version for 5 minutes before moving to 100%. This leverages the `AWS::CodeDeploy::Application` and `AWS::CodeDeploy::DeploymentGroup` resources, with pre- and post-traffic hook Lambda functions for validation. In real-world scenarios, you can combine this with CloudWatch alarms to automatically roll back if error rates spike during the canary window.
KKey Concepts to Remember
- DeploymentPreference is a property of AWS::Serverless::Function in SAM.
- It enables traffic shifting deployments for Lambda and API Gateway using AWS CodeDeploy.
- Canary and Linear deployment types are supported for gradual traffic shifts.
- It allows defining pre- and post-traffic shifting hooks and alarms for deployment monitoring.
TExam Day Tips
- Watch for words such as best, first, most likely and least administrative effort.
- Review why wrong options are wrong, not only why the correct option is correct.
Key takeaway
DeploymentPreference is a property of AWS::Serverless::Function in SAM.
Real-world example
How this comes up in practice
A cloud solutions architect for a retail company is evaluating services for a new workload. The correct answer here reflects best practice for the specific scenario described — not a general cloud recommendation. DeploymentPreference is a property of AWS::Serverless::Function in SAM. Cloud exam questions reward reading the constraint carefully: the same technology can be right or wrong depending on the use case.
What to study next
Got this wrong? Here's your next step.
Review deploymentPreference is a property of AWS::Serverless::Function in SAM., then practise related DVA-C02 questions on the same topic to reinforce the concept.
- →
Deployment — study guide chapter
Learn the concepts, then practise the questions
- →
Deployment practice questions
Targeted practice on this topic area only
- →
All DVA-C02 questions
1,616 questions across all exam domains
- →
AWS Certified Developer Associate DVA-C02 study guide
Full concept coverage aligned to exam objectives
- →
DVA-C02 practice test guide
How to use practice tests most effectively before exam day
Related practice questions
Related DVA-C02 practice-question pages
Use these pages to review the topic behind this question. This is how one missed question becomes focused revision.
Development with AWS Services practice questions
Practise DVA-C02 questions linked to Development with AWS Services.
Security practice questions
Practise DVA-C02 questions linked to Security.
Deployment practice questions
Practise DVA-C02 questions linked to Deployment.
Troubleshooting and Optimization practice questions
Practise DVA-C02 questions linked to Troubleshooting and Optimization.
DVA-C02 fundamentals practice questions
Practise DVA-C02 questions linked to DVA-C02 fundamentals.
DVA-C02 scenario practice questions
Practise DVA-C02 questions linked to DVA-C02 scenario.
DVA-C02 troubleshooting practice questions
Practise DVA-C02 questions linked to DVA-C02 troubleshooting.
Practice this exam
Start a free DVA-C02 practice session
Short sessions build daily habit. Longer sessions build exam-day stamina. Try a timed session to simulate real conditions.
FAQ
Questions learners often ask
What does this DVA-C02 question test?
Deployment — This question tests Deployment — DeploymentPreference is a property of AWS::Serverless::Function in SAM..
What is the correct answer to this question?
The correct answer is: DeploymentPreference — Option A is correct because the `DeploymentPreference` attribute in AWS SAM's `AWS::Serverless::Api` resource enables canary deployments for API Gateway stages. This attribute allows you to configure traffic shifting patterns, such as linear or canary, by specifying settings like `Type` (e.g., `Canary10Percent5Minutes`) and `Alarms` to automatically roll back on failures. It directly integrates with AWS CodeDeploy to manage the gradual traffic shift without manual intervention.
What should I do if I get this DVA-C02 question wrong?
Review deploymentPreference is a property of AWS::Serverless::Function in SAM., then practise related DVA-C02 questions on the same topic to reinforce the concept.
What is the key concept behind this question?
DeploymentPreference is a property of AWS::Serverless::Function in SAM.
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 →
Same concept, more angles
3 more ways this is tested on DVA-C02
These questions test the same concept from different angles. Work through them to make sure you can recognise it however the exam phrases it.
Variation 1. A company deploys a serverless application using AWS SAM. The application includes an API Gateway REST API and multiple Lambda functions. The developer wants to deploy a new version of the API with a canary release strategy, sending 10% of traffic to the new version initially. Which SAM template configuration should the developer use?
medium- ✓ A.Set Type: Canary in the DeploymentPreference of the Lambda function and add CanarySetting: { Percent: 10 } under DeploymentPreference.
- B.Set CanarySetting: { Percent: 10 } in the API Gateway resource's properties.
- C.Set Type: Canary and TrafficShiftType: Canary in the DeploymentPreference of the Lambda function.
- D.Set Type: Canary in the DeploymentPreference of the Lambda function and add a Percentage: 10 property.
Why A: Option A is correct because AWS SAM's `DeploymentPreference` with `Type: Canary` on the Lambda function enables canary traffic shifting for the API Gateway integration. The `CanarySetting` property with `Percent: 10` specifies that 10% of traffic is initially routed to the new Lambda version, while the remaining 90% goes to the previous version. This configuration leverages SAM's built-in CodeDeploy integration to manage the canary release automatically.
Variation 2. A developer is deploying a serverless application using AWS SAM. The application consists of an API Gateway endpoint that triggers an AWS Lambda function. The developer wants to enable canary deployments to gradually shift traffic to a new Lambda version. Which SAM resource attribute should the developer configure?
medium- A.ReservedConcurrentExecutions
- B.Timeout
- ✓ C.AutoPublishAlias and DeploymentPreference
- D.ProvisionedConcurrency
Why C: Option D is correct because SAM's AutoPublishAlias property combined with DeploymentPreference enables canary deployments. Option A is wrong because ProvisionedConcurrency is for pre-provisioned capacity. Option C is wrong because ReservedConcurrentExecutions limits concurrency. Option B is wrong because Timeout is for function execution time.
Variation 3. A developer is deploying a serverless application using AWS SAM. The application consists of an API Gateway REST API and multiple AWS Lambda functions. The developer wants to deploy the application to a production environment with minimal downtime. Which deployment strategy should the developer use?
easy- A.Create a blue/green deployment using AWS Elastic Beanstalk.
- B.Delete the existing stack and deploy a new one.
- C.Perform a rolling update by updating functions one by one.
- ✓ D.Use SAM's built-in canary deployment with traffic shifting.
Why D: Option A is correct because AWS SAM supports canary deployments, which allow traffic shifting gradually to new versions, minimizing downtime. Option B is wrong because rolling updates are not natively supported by SAM for Lambda. Option C is wrong because blue/green deployments require manual setup and are not built into SAM. Option D is wrong because replacing the stack causes downtime.
Last reviewed: Jun 11, 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.