Lesson 1 of 3 Deployment Strategies and Troubleshooting

Choosing and Implementing Deployment Strategies

This lesson explains how a deployment strategy determines how a new version replaces the old one, how much is at risk at any time and how quickly a bad release can be reversed.

Learning outcomes

After completing this lesson, you will be able to:

  • Compare all-at-once, rolling, blue/green and canary strategies.
  • Implement strategies on each compute platform.
  • Make deployments safe with alarms and automatic rollback.

The strategies

All at once (in place) updates every instance simultaneously; it is fast and cheap but causes downtime and a full outage if the version is bad. Rolling updates batches of instances in place, keeping some capacity serving, but running mixed versions during the deployment and reducing capacity unless extra instances are added (rolling with additional batch). Immutable launches a completely new set of instances with the new version and switches to them only when healthy, so rollback is just terminating the new instances. Blue/green runs a full new environment (green) next to the current one (blue) and switches traffic at the load balancer or DNS, allowing instant rollback by switching back. Canary sends a small percentage of traffic to the new version first, then the rest; linear shifts traffic in equal increments at intervals.

StrategyDowntimeRollback speedExtra cost during deployRisk exposure
All at onceYesSlow (redeploy)NoneAll users
RollingNo (reduced capacity)Slow (roll back batches)None or one batchGrowing share
ImmutableNoFastDouble capacity brieflyLimited until switch
Blue/greenNoInstant (switch back)Full second environmentControlled at switch
Canary / linearNoInstant (shift back)Some extra capacitySmall share first

The following diagram orders the strategies by risk.

Deployment strategies from fastest and riskiest to safest. All at once updates every instance in place and causes downtime. Rolling updates batches, running mixed versions with reduced capacity. Immutable launches new instances and switches when they are healthy. Blue/green runs a full new environment and switches traffic, with instant rollback.
Safer strategies need more capacity during the deployment.
Match the pairs

Deployment strategies

Exam skills 3.1.5

Match each deployment strategy with its description.

Log in to try this activity Interactive activities are free with an account.

Implementing strategies on AWS

Each compute platform has its own mechanism. For EC2 Auto Scaling groups, instance refresh implements rolling or immutable-style replacement with minimum and maximum healthy percentages, checkpoints and alarm-based rollback, and blue/green is implemented with two groups behind ALB weighted target groups or Route 53 weighted records. For ECS, services support rolling updates with the circuit breaker and built-in blue/green, linear and canary deployments. For Lambda, alias weighted routing shifts a percentage of invocations to a new version. CloudFormation updates with UpdatePolicy perform rolling or replacing updates of Auto Scaling groups. AWS CodeDeploy remains available for EC2, on-premises, ECS and Lambda deployments with deployment configurations such as CodeDeployDefault.HalfAtATime and canary or linear traffic shifting.

PlatformRolling / immutableBlue/greenCanary / linear
EC2 Auto ScalingInstance refreshTwo groups + ALB weighted target groups or Route 53 weightedALB weights adjusted in steps
ECSRolling update with circuit breakerBuilt-in blue/greenBuilt-in linear and canary
Lambda-Alias switchAlias weighted routing
DNS level-Route 53 weighted or failover recordsRoute 53 weights

Deployment safety

Safe deployments limit the blast radius and detect problems automatically. CloudWatch alarms on error rates and latency tied to automatic rollback (instance refresh, ECS deployments, CloudFormation rollback triggers), bake times between stages, health checks that reflect real readiness, and deploying to one AZ or Region before others are all signs of a well-designed answer. DNS-based switching is subject to client caching, so load balancer weights switch traffic faster and more predictably than DNS changes.

Scenario questions

Safe deployments

Exam skills 3.1.5

Choose the strategy that meets each deployment requirement.

Log in to try this activity Interactive activities are free with an account.
Worked example

Choosing a strategy

A team deploys a new version of a web application running in an Auto Scaling group behind an ALB. Requirements are no downtime, the ability to roll back within one minute, and no mixed versions serving the same user session. Rolling updates mix versions and roll back slowly. The team creates a second Auto Scaling group (green) with the new launch template, registers it with a second target group, and uses an ALB listener rule with weighted target groups and target group stickiness to move 10%, then 50%, then 100% of traffic. Rolling back is changing the weights back to blue.

Check yourself

Which strategy causes downtime?

Show answer

All at once, because every instance is updated at the same time.

Exam Tips

Remember for the exam

  • Immutable and blue/green give the fastest rollback; all at once causes downtime.
  • Instance refresh implements rolling replacement for Auto Scaling groups.
  • ALB weighted target groups switch traffic faster than DNS.
  • Lambda alias weights and ECS built-in strategies provide canary and linear deployments.
  • Tie deployments to CloudWatch alarms for automatic rollback.