Skip to main content
networking

Blue-Green Deployment

Blue-green deployment maintains two identical production environments. Traffic routes to 'blue' (current). New version deploys to 'green' (idle). After validation, traffic switches from blue to green instantly (DNS change or load balancer swap). Rollback is instant – switch back to blue. Doubles infrastructure cost during deployment.

Definition

Blue-green deployment eliminates deployment downtime and risk by maintaining two complete production environments. The active environment (blue) serves all traffic. The new version deploys to the inactive environment (green), where it undergoes smoke testing and validation against production data. When ready, the router/load balancer switches all traffic from blue to green atomically. If problems emerge, switching back to blue provides instant rollback with zero data loss (assuming the database is shared or migrations are backward-compatible). The cost is doubled infrastructure during the transition period (both environments fully provisioned). Database schema changes require careful coordination – the schema must be compatible with both versions during the switch window. Implementations: AWS Route 53 weighted routing (0% green, then 100% green), Kubernetes service selector update, load balancer target group swap, or DNS CNAME update.

Examples

  • AWS: switch ALB target group from blue-tg to green-tg
  • Kubernetes: update Service selector from version=blue to version=green
  • DNS: CNAME app.example.com from blue.infra to green.infra (TTL must be low)

Related Protocols

Related Terms