AWS Deployment Patterns: Blue/Green, Canary, & Rolling
In the AWS Certified Solutions Architect – Associate (SAA-C03) exam, understanding how to release software while minimizing downtime and risk is critical. Deployment patterns dictate how traffic shifts from an old version of an application (Version 1) to a new version (Version 2).
The Restaurant Analogy
Imagine you own a popular pizza shop and want to introduce a new recipe:
- Blue/Green: You build an identical second pizza shop next door. Once the new shop is ready with the new recipe, you lock the door of the old shop and point a sign to the new one. If customers hate the pizza, you just unlock the old shop.
- Canary: You keep your current shop but serve the new recipe to only 5% of your customers. If they don’t get a stomach ache, you gradually serve it to everyone else.
- Rolling: You have 10 tables. You renovate 2 tables at a time. While 2 are being updated, the other 8 are still serving customers.
Core Concepts & Well-Architected Lens
Deployment patterns directly support the Reliability and Operational Excellence pillars of the AWS Well-Architected Framework.
The “Why”
- Reliability: Reduces the “Blast Radius” of a failed deployment.
- Operational Excellence: Enables automated rollbacks and “Mean Time to Recovery” (MTTR) reduction.
- Cost Optimization: Choosing Rolling over Blue/Green saves money by not duplicating resources.
Comparison of Deployment Strategies
| Pattern | Deployment Speed | Rollback Speed | Cost Impact | Risk Level |
|---|---|---|---|---|
| Blue/Green | Fast (Traffic Switch) | Instant (Switch Back) | High (2x Resources) | Lowest |
| Canary | Slow/Incremental | Fast | Medium | Low (Small Blast Radius) |
| Rolling | Medium | Slow (Re-deploy old) | Low (No extra cost) | Medium |
| All-at-Once | Fastest | Slow | Low | High (Downtime) |
Decision Matrix: When to use What?
IF the requirement is Zero Downtime and Instant Rollback is the priority → USE Blue/Green.
IF the requirement is to Test in Production with real users safely → USE Canary.
IF the requirement is Cost Sensitivity and downtime is acceptable/minimized → USE Rolling.
IF the application is Stateful (Session data in memory) → USE Blue/Green with session draining.
Exam Tips: Golden Nuggets
- Route 53: Use Weighted Routing to achieve Canary or Blue/Green deployments at the DNS level.
- AWS CodeDeploy: Supports all three. Look for keywords like
LinearorCanaryin the deployment configuration. - Elastic Beanstalk: Offers “Immutable” and “Rolling with Additional Batch” to maintain full capacity during updates.
- ALB Target Groups: Blue/Green is often achieved by having two target groups and shifting the listener weights.
- Database Trap: Blue/Green is easy for compute (EC2/Lambda), but hard for Databases. SAA exams often distract you with “Blue/Green DB” — remember that schema changes must be backward compatible!
Visualizing Traffic Shifting
Diagram: Blue/Green Traffic Shift via Weighted Target Groups
Key Services
Route 53: Weighted routing for DNS-level Canary.
CodeDeploy: Automates deployment configs (Linear/Canary).
App Mesh: Fine-grained traffic control for Microservices.
Common Pitfalls
Hardcoded IPs: Always use DNS names or Load Balancer endpoints.
DB Schema: Rolling back code doesn’t roll back a DROP COLUMN database command!
Quick Patterns
Linear: 10% every 10 mins until 100% (Safe).
All-at-Once: Fast but involves downtime (Dev/Test only).
Immutable: Fresh EC2 instances every time (Cleanest).