practiceEngineering & architecture

Blue-Green Deployment

Blue-green deployment prepares a replacement environment alongside the live one and switches traffic after validation.

Download Markdown (.md)

01What it means

Blue-green deployment maintains two environments with equivalent production roles: one serves users while the other receives the candidate release. After checks, routing moves traffic to the replacement. The previous environment may remain available for rollback, but shared data and external side effects need their own compatibility strategy.[1][2]

02Why it matters

Preparing a complete replacement can reduce deployment interruption and make application rollback faster. It also separates release preparation from the moment users begin receiving the new version.

03When to use it

Use it when equivalent environments and controlled traffic switching are feasible. Weigh duplicated capacity and state-management costs. For tightly coupled data migrations or systems that cannot tolerate mixed versions, solve those constraints before promising a reversible switch.

04How it works

  1. Prepare the inactive environment with the candidate version and production-equivalent configuration.
  2. Validate health, dependencies, capacity, and data compatibility.
  3. Plan session handling, background jobs, connection draining, and rollback conditions.
  4. Switch routing and observe user-facing outcomes.
  5. Retain the previous environment for the agreed recovery window, then retire or reuse it.

05A practical example

Example

A reporting application deploys to its green environment and checks a read-only report against shared data. Traffic then switches from blue to green. A compatible schema allows application rollback, while a planned destructive schema cleanup is deferred until the recovery window closes.

06Where it breaks

Duplicated infrastructure costs money and can drift. Routing changes are not necessarily instantaneous, and old sessions or workers may remain active. Reverting application traffic does not restore overwritten data or undo external actions.

Common mistakes

  • Claiming rollback is safe without checking schema compatibility.
  • Running duplicate scheduled jobs in both environments.
  • Testing an inactive environment with materially different configuration.

07Sources

  1. Blue Green DeploymentMartin Fowler · Practitioner guidanceBlue Green Deployment
  2. Blue/Green Deployments on AWSAmazon Web Services · Cloud architecture whitepaperBlue/Green Deployments on AWS
View saved topics

Start typing to search titles, definitions, categories, and frameworks.