Blue/Green Deployment
What is it?
Blue/green deployment runs two identical environments — one live, one idle — and switches traffic to the new version all at once, with instant rollback.
Explain like I'm 5
Why was it created?
Updating servers in place risks downtime and messy rollbacks. Blue/green was adopted to release with near-zero downtime and easy reversal.
Where is it used?
- Zero-downtime releases
- Web and API deployments
- Critical services
- Safe, reversible rollouts
Why should developers care?
It's a common safe-deployment strategy, so DevOps and backend engineers should understand when and how to use it.
How does it work?
You keep two environments: 'blue' (current) and 'green' (new version). You deploy and test on the idle one, then switch the router/load balancer to send all traffic there. If something's wrong, you switch back instantly.
Real-world example
A team deploys version 2 to the green environment, verifies it, flips the load balancer from blue to green, and keeps blue ready for instant rollback.
Common use cases
- Near-zero-downtime releases
- Instant rollback
- Safe production cutover
- Validating before going live
Advantages
- Near-zero downtime
- Instant rollback
- Test the new version before cutover
- Clean, all-at-once switch
Disadvantages
- Needs double the infrastructure
- Database changes are tricky
- Costlier
- All-at-once exposure to all users
When should you use it?
When you want safe, reversible releases with minimal downtime and can afford a second environment.
When should you avoid it?
When running duplicate environments is too costly, or a gradual rollout (canary) is preferred.
Alternatives
Related terms
Interview questions
Beginner
- What is blue/green deployment?
- Why does it enable instant rollback?
Intermediate
- How does traffic get switched?
- What's the database challenge with blue/green?
Senior
- How do you handle schema migrations safely in blue/green?
- When would you choose canary over blue/green?
Common misconceptions
- "Blue/green rolls out gradually" — it switches all traffic at once; canary is the gradual approach.
- "Rollback means redeploying" — with blue/green you just switch back to the still-running old environment.
Fun facts
- The two environments are conventionally named blue and green to avoid implying an order.
- The old environment is kept warm so rollback is just a traffic switch.
Timeline
- 2010s — Blue/green deployment popularized with cloud infrastructure
Learning resources
Quick summary
Blue/green deployment switches all traffic between two identical environments for near-zero-downtime releases and instant rollback.
Cheat sheet
- Two identical environments
- Switch traffic all at once
- Instant rollback
- Costs double infrastructure