Tech Terms Explained Open in the app →

Blue/Green Deployment

DevOps · Intermediate · 4 min read

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

Blue/green deployment is like setting up a second, fully-ready stage next to the live one: when it's perfect, you flip a switch so the audience watches the new stage — and you can flip back instantly if needed.

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

Canary deployment (gradual)Rolling deploymentIn-place updates

Related terms

Canary DeploymentCI/CDLoad BalancerHigh Availability

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

If you remember only one thing

Blue/green keeps a ready duplicate environment so you can switch to the new version — and back — instantly.