Glossary · Cloud & DevOps

What is blue-green deployment?

Short answer

Blue-green deployment is a release technique that runs two identical production environments. One (blue) serves live traffic while the new version is deployed and tested on the other (green); traffic is then switched to green in one step. If something goes wrong, switching back to blue is an instant rollback.

How it works

  1. Blue runs the current version and receives all traffic.
  2. Deploy the new version to green, run smoke tests and warm caches while users see nothing.
  3. Switch the load balancer, DNS or router to send traffic to green.
  4. Keep blue running for a while. If errors rise, switch back in seconds.

The hard part: the database

Both environments usually share one database, so schema changes must work with the old and the new code at the same time. Use the expand and contract approach: add new columns or tables first (expand), deploy code that uses them, and remove the old ones in a later release (contract). Never rename or drop a column in the same release that stops using it.

Blue-green or canary?

Blue-green switches all users at once. A canary release sends a small share of traffic, say 5%, to the new version first and increases it gradually, which limits the impact of a bad release but needs more routing and monitoring. Many platforms, including Kubernetes, managed container services and edge platforms with versioned deployments, support both.

Published · Updated · By · All terms

Go deeper