Skip to content

Blue-Green Deployment

Key idea:

Blue-Green deployment — strategy with two identical production environments: Blue (current live) and Green (new version). Load balancer switches 100% of traffic to Green for deploy, revert instantly if anything breaks. Plus: zero downtime, instant rollback. Minus: double infrastructure cost during deploy, DB schema migrations are tricky (both versions must work on same DB).

Below: details, example, related terms, FAQ.

Try it now — free →

Details

  • Blue = production, Green = idle replica
  • Deploy new version to Green
  • Smoke tests on Green via internal URL
  • DNS/LB switch: Green now live, Blue idle
  • Rollback = switch back to Blue (instant)

Example

# nginx load balancer switch
upstream backend {
  server 10.0.0.1:8080;  # Blue
  # server 10.0.0.2:8080;  # Green (commented until deploy)
}
# After deploy: swap comments, nginx -s reload

Related Terms

Learn more

Frequently Asked Questions

Blue-green vs rolling?

Rolling: update pods one at a time (K8s default). Blue-green: 2 full envs + swap. Blue-green safer for stateful, rolling simpler for stateless.

Double infrastructure cost — worth it?

During deploy — yes (hours). Not needed permanently — create Green at deploy time, destroy after success.

DB migrations — how?

Schema must be backwards-compatible (no drop columns, no rename). Forward-compatible: add nullable columns, defaults.