How traffic moves from old to new
Pick a deployment strategy based on how risky the change is and how fast you can detect failure. Three classic shapes:
Recreate (downtime deploy)
- Stop old, start new. Brief downtime.
- Easiest to reason about. Default for personal projects, low-traffic services.
- Bad for: anything with users.
Rolling
- Replace instances N at a time. Old + new run side by side mid-deploy.
- Default for Kubernetes deployments, ECS rolling, etc.
- Watch for: schema changes that break old instances reading new schema (or vice versa).
Blue/Green
- Two full copies of prod (blue + green). Deploy to inactive, run smoke, flip traffic, decommission old.
- Instant rollback by flipping the load balancer back.
- Costs: 2× infrastructure during deploy.
Canary
- Deploy to 1 → 5 → 25 → 100% of traffic over time.
- Monitor error rate / latency at each step. Auto-roll back if it spikes.
- The gold standard. Requires good observability and a feature-flag or weighted-router.
The pipeline shape mirrors the strategy
A canary pipeline has more jobs (one per traffic step) than a rolling one (one big deploy). The strategy you pick determines the YAML shape and how complicated rollback is.