Cloud & DevOps6h estimated

Immutable Infrastructure & Blue-Green Deployment

Difficulty
Importance

The problem

Updating a running server in place — patching it, changing its configuration live — makes that server's exact state increasingly unknown and hard to reproduce over time, and rolling out a bad update this way affects live traffic immediately with no easy way back.

Why now

Containers and Docker already established that an image is an immutable, reproducible snapshot of an environment; immutable infrastructure applies that same never-modify-in-place discipline to entire deployments, and CI/CD pipelines already established the automation needed to build and deploy a full replacement quickly enough to make this practical.

Mental model

Immutable infrastructure never patches a running server — it builds a brand new one from the updated image and replaces the old one entirely, the same 'replace, don't mutate' discipline mutability-and-references already taught for objects, now applied to whole servers. Blue-green deployment takes this further: run the new version (green) fully alongside the old one (blue), switch traffic over instantly once it's verified healthy, and keep blue around briefly as an instant rollback if anything's wrong.

Requires

Used in

Projects

  • Set up a blue-green deployment for a small application: run two versions simultaneously behind a load balancer, verify the new one, then switch traffic and keep the old one available for rollback
  • Explain, with a real example, how configuration drift (manual changes accumulating on a long-running server) becomes impossible under immutable infrastructure

Examples

  • A blue-green deployment can roll back a bad release by simply switching the load balancer back to the blue environment, without any redeployment
  • A server that's been manually patched a dozen times over a year has configuration drift — its exact state can no longer be reliably reproduced from any single source of truth

Resources

Mastery checklist