← Lessons

quiz vs the machine

Silver1100

System Design

Blue Green Deployment

Two identical environments and one switch you can flip back instantly.

4 min read · intro · beat Silver to climb

The setup

Blue green deployment runs two identical production environments named blue and green. At any moment only one serves live traffic. Say blue is live. You deploy the new version to the idle green environment, test it in isolation, and when it looks healthy you switch the router to send all traffic to green.

Why it helps

  • The switch is near instant because it is just a routing change.
  • Rollback is trivial: point traffic back at blue, which is still running the old version.
  • Testing happens on a production like environment before any user sees it.

The costs

  • You pay for double the infrastructure during the cutover.
  • Database changes must be compatible with both versions, since both may briefly run.

The cutover is all or nothing for traffic, which is its main difference from a canary that shifts traffic gradually.

Key idea

Blue green keeps two full environments so you can switch traffic instantly and roll back by flipping the router back.

Check yourself

Answer to earn rating on the learn ladder.

1. How do you roll back a blue green deployment?

2. What is a main cost of blue green deployment?