Choosing Progressive Delivery and Rollback Strategies
This lesson explains how the deployment strategy decides how much risk each release carries and how fast you can recover, in questions that ask for zero downtime, no capacity loss or automatic rollback.
Learning outcomes
After completing this lesson, you will be able to:
- Choose CodeDeploy deployment types for each platform.
- Describe ECS and Lambda deployment options.
- Shift traffic with ALB weighted target groups, Route 53 and other levers.
- Explain how blue/green deployments release database changes safely.
AWS CodeDeploy
CodeDeploy's options depend on the compute platform. On EC2 and on-premises servers, an in-place deployment updates instances a batch at a time, while a blue/green deployment launches new instances, registers them behind the load balancer and removes the old ones, so rollback means switching back. For Lambda, CodeDeploy shifts the weight of a function alias to the new version. A canary sends a small share, such as 10% for five minutes, then the rest. A linear deployment adds equal steps, such as 10% every minute, and the alternative is all at once. For ECS, blue/green deployments can route test traffic to the new task set before the cutover. The following table summarises the options.
| Target | Deployment options |
|---|---|
| EC2 and on-premises | In-place (rolling) or blue/green with new instances behind the load balancer |
| Lambda | Alias weight shifting: canary (e.g. 10% for 5 minutes), linear (e.g. 10% every minute) or all at once |
| ECS | Blue/green with test traffic before cutover |
CodeDeploy rolls back automatically on failure or when CloudWatch alarms fire.
The following diagram shows how much traffic reaches the new Lambda version over time in each option.

CodeDeploy configurations
Other platforms
Amazon ECS has its own deployment options. Its rolling update replaces tasks within minimum and maximum healthy percentages, and the deployment circuit breaker stops a deployment whose tasks fail to start or become healthy and rolls it back to the last working revision. Native blue/green, linear and canary deployments run the new revision beside the old one and shift load balancer traffic, with a bake time for rollback.
Elastic Beanstalk offers deployment policies that trade speed against risk: all at once, which causes downtime; rolling, which reduces capacity; rolling with an additional batch, which keeps full capacity; immutable, which deploys to new instances and gives the safest rollback within one environment; traffic splitting, which is a canary; and blue/green by swapping environment URLs between two environments.
Other traffic levers
Traffic can also be shifted between versions without CodeDeploy, and the levers differ in speed and scope. ALB weighted target groups split traffic between versions at the load balancer, so a change takes effect at once, with no DNS caching. Route 53 weighted records split traffic in DNS, which works across Regions and endpoints, but clients cache answers, so shifts are gradual and imprecise. API Gateway canary releases send a percentage of a stage's traffic to a new deployment. An Auto Scaling instance refresh replaces instances progressively, with checkpoints and rollback. AppConfig feature flags turn features on gradually without redeploying code. The following table summarises the levers.
| Lever | Notes |
|---|---|
| ALB weighted target groups | Instant shift with no DNS caching |
| Route 53 weighted records | Subject to DNS caching |
| API Gateway canary releases | Per stage |
| Auto Scaling instance refresh | Checkpoints and rollback |
| AppConfig feature flags | Turn features on gradually without redeploying |
Databases
Databases are the hardest part of a safe release, because they hold state that a rollback cannot simply discard. For engine changes, RDS and Aurora Blue/Green Deployments create a synchronised staging copy on which a major version upgrade or parameter change is applied and tested, and switch over in about a minute, keeping the same endpoints.
For schema changes made with application releases, the changes must be backward compatible, because during a canary or blue/green deployment the old and new application versions run against the same database. The expand-and-contract technique adds new columns or tables first, releases code that uses them, and removes the old structures only when no running version needs them, so a rollback of the application is always possible.
A backward-compatible schema change
An instant, DNS-free canary on an ALB
An EC2-based application must expose a new version to 10% of users, switch back instantly if problems appear, and avoid DNS caching delays. Two target groups (blue and green) sit behind one listener, and a weighted forward action splits traffic:
aws elbv2 modify-listener --listener-arn $LISTENER_ARN --default-actions '[{
"Type": "forward",
"ForwardConfig": {
"TargetGroups": [
{ "TargetGroupArn": "'$BLUE_TG'", "Weight": 90 },
{ "TargetGroupArn": "'$GREEN_TG'", "Weight": 10 }
],
"TargetGroupStickinessConfig": { "Enabled": true, "DurationSeconds": 600 }
}
}]'Stickiness keeps each user on one version during the test, so a session does not bounce between them. Rolling back is one API call that sets green to 0. Compared with Route 53 weighted records, the change takes effect immediately for every client; compared with CodeDeploy, it gives full control over the steps but requires automation (for example Step Functions watching an alarm) to roll back by itself.
Which CodeDeploy configuration shifts Lambda traffic in equal steps at fixed intervals?
Show answer
A linear configuration, such as LambdaLinear10PercentEvery1Minute. Canary configurations shift a small share first and then the rest.
Exam Tips
Remember for the exam
- A Lambda canary with automatic rollback uses CodeDeploy with CloudWatch alarms.
- To avoid losing capacity during Beanstalk deployments, use rolling with an additional batch, or immutable.
- For a failed ECS deployment to roll back automatically, enable the deployment circuit breaker.
- For a database major version upgrade with minimal downtime, use RDS Blue/Green Deployments.
- To release features gradually without redeploying, use AppConfig feature flags.
- For an instant switch that avoids DNS caching, use ALB weighted target groups.