Deployment strategies and rollbacks: DVA-C03 study notes and practice questions
What to know about Deployment strategies and rollbacks for the DVA-C03 exam, from the Testing and Deployment domain (22% of the exam guide), then 2 free questions to test it. Part of the DVA-C03 study guide.
These questions describe a release constraint, such as zero downtime, a small blast radius or a fast undo, and ask for the strategy that meets it.
The strategies
All at once moves all traffic in one step: fastest and riskiest.
Canary shifts a small share of traffic first, waits, then shifts the rest. Use it when a short test period on real traffic is the goal.
Linear shifts traffic in equal steps at fixed intervals. Use it when problems should show up gradually.
Blue/green runs the new version beside the old one, then switches traffic. The old environment stays available, so rollback is a fast switch back.
Rolling replaces instances in batches. Capacity dips during the update, and old and new versions serve traffic together for a while.
CodeDeploy
Lambda deployments use deployment configurations that shift traffic between two versions of an alias, such as all at once, canary or linear. CodeDeploy can run hooks before and after traffic shifts, and it rolls back when an alarm fires.
ECS blue/green deployments through CodeDeploy create a replacement task set, can send a test listener’s traffic to it first (the AfterAllowTestTraffic hook), shift the production listener, and terminate the old set after a wait period. ECS also has its own built-in blue/green strategy with a bake time and lifecycle hooks.
EC2 and on-premises deployments support in-place and blue/green. In-place updates instances where they run, so capacity drops during the deployment. CodeDeployDefault.OneAtATime, HalfAtATime and AllAtOnce, or a custom minimum healthy hosts value, set how many instances update at once.
Elastic Beanstalk
All at once and Rolling reduce capacity during the update. Rolling with additional batch launches an extra batch first, so capacity stays full.
Immutable launches a fresh set of instances and swaps them in, so no existing instance runs a mix of versions.
Traffic splitting sends a percentage of traffic to fresh instances for a test period, like a canary. It needs an Application Load Balancer.
Blue/green uses a second environment and a CNAME swap, so the public URL stays the same.
Rollback
Automatic rollback happens when a deployment fails or a CloudWatch alarm goes into alarm during the deployment. CodeDeploy and AppConfig both support this.
Manual rollback means redeploying the last good revision, or moving an alias back.
CloudFormation rolls back a failed stack update automatically. Rollback triggers add CloudWatch alarms that cause a rollback during the update.
AppConfig rolls back a configuration when an alarm fires during the deployment or the bake time that follows it.
How to choose
Scenario wording
Answer
Instant switch back, and the old version must stay running
Blue/green
Test on a small share of real traffic before going all the way
Canary
Increase traffic gradually and watch for errors
Linear
Keep full capacity during a release, and no instance serves a mix of versions
Blue/green
Roll back automatically when an alarm fires during a Lambda release
CodeDeploy with alarms configured
Roll back a CloudFormation update automatically when an alarm fires
Rollback triggers
Common traps
Choosing all at once when the question asks for a limited blast radius.
Choosing in-place when the question says capacity must stay full. In-place reduces capacity on each instance as it updates.
Expecting automatic rollback without alarms. Without a configured alarm or failure, CodeDeploy does not roll back on its own.
Confusing canary and linear. A canary has one early step, linear has equal steps.
A team deploys a Lambda function with AWS SAM, with AutoPublishAlias set to live.
For each release, 10% of invocations should shift to the new version first, and all remaining traffic should move to it 10 minutes later. The new version must pass a smoke-test Lambda function before any traffic shifts. If an error alarm enters the ALARM state during the deployment, traffic must roll back automatically.
Which DeploymentPreference meets these requirements?
Choose one answer.
AA. Type: Linear10PercentEvery1Minute, with the error alarm under Alarms and the smoke test under Hooks PreTraffic.
BB. Type: Canary10Percent10Minutes, with the error alarm under Alarms and the smoke test under Hooks PreTraffic.
CC. Type: Canary10Percent5Minutes, with the error alarm under Alarms and the smoke test under Hooks PostTraffic.
DD. Type: AllAtOnce, with the smoke test under Hooks PreTraffic and the error alarm under Alarms.
Show the answer and explanation
Answer: B
A. Wrong: Linear shifts traffic in equal increments, here 10% every minute. It does not move 10% first and then everything after 10 minutes, so the timing is wrong.
C. Wrong: This uses a 5-minute interval instead of 10. A PostTraffic hook runs after traffic has already shifted, so it cannot keep the new version from receiving traffic.
D. Wrong: AllAtOnce sends every request to the new version at once. It skips the 10% canary stage and the 10-minute wait the team requires.
Explanation
SAM's DeploymentPreference uses CodeDeploy to shift traffic between alias versions. A canary type shifts a percentage first and the remainder after an interval, a PreTraffic hook validates the new version before any shift, and CloudWatch alarms listed under Alarms trigger an automatic rollback.
SAM shifts 10 percent of traffic to the new version for 10 minutes after the PreTraffic smoke test, and the alarm can roll it back.
A web application runs in an AWS Elastic Beanstalk environment behind a Classic Load Balancer, which the team cannot replace this quarter.
Each release must keep the environment at full capacity, must leave the instances serving traffic untouched until the new instances pass health checks, and must not update existing instances in place. If the new instances fail health checks, they should be terminated and the old ones kept.
Which deployment policy should the developer choose?
Choose one answer.
AA. All at once: every instance is updated together
BB. Rolling: batches of instances are updated in place
CC. Traffic-splitting: a new group takes a share of live traffic
DD. Immutable: a full new group of instances replaces the old one
Show the answer and explanation
Answer: D
A. Wrong: All at once takes every instance out of service together, so capacity drops for a short time. It breaks the full-capacity requirement and changes the instances that serve traffic.
B. Wrong: Rolling takes batches of instances out of service, which reduces capacity during the deployment. It also updates existing instances in place, so a failure leaves some of them changed.
C. Wrong: Traffic-splitting gives canary-style testing with full capacity, but it needs an Application Load Balancer. This environment uses a Classic Load Balancer that the team cannot replace this quarter.
D. Right: Correct. Immutable launches a full set of new instances in a separate Auto Scaling group, and the original instances are left untouched. If the new instances fail health checks, Elastic Beanstalk terminates them. Learn more: Elastic Beanstalk deployment policies (opens in a new tab)
Explanation
Immutable deployments launch a full new group of instances alongside the old one, so capacity stays up and existing instances are never changed. Traffic-splitting also protects the old instances, but it requires an Application Load Balancer, which this environment does not have.
Want more on Deployment strategies and rollbacks? The 5 full-length practice sets have 11 more Deployment strategies and rollbacks questions, 390 in all, none of them in the free exam. One payment of $14.99, no subscription. See the practice sets →