# Blue-Green Deployments

Blue-green deployments release application changes by preparing a separate production-ready environment and switching traffic from the current environment to the new one.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/blue-green-deployments

> Two environments coexist during a release: blue serves the current version while green runs the replacement version for validation and promotion. Separating deployment from traffic cutover reduces release-related downtime and enables rapid traffic rollback, provided application state and dependencies remain compatible.

Practice exams covering Blue-Green Deployments: [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional).

## 6 key aspects of Blue-Green Deployments

Blue-green deployments combine separate release environments, controlled routing, compatible state, sufficient capacity, and measurable rollback criteria to reduce deployment disruption.

1. **Separate deployment and production exposure**: Prepare the replacement environment without changing the environment currently serving users. Promote it only after health checks, integration tests, and operational readiness checks pass.
2. **Controlled traffic cutover**: Move traffic using load balancer routing, Kubernetes routing, or DNS changes. Account for propagation, connection draining, sticky sessions, and clients that retain existing connections.
3. **Retained rollback environment**: Keep the previous version healthy and available for a defined observation window. Traffic rollback is useful only if that version can still process current data and safely interact with shared dependencies.
4. **State and schema compatibility**: Design database migrations, session handling, and message consumers for a period when both versions exist. Application rollback does not automatically undo database changes or external side effects.
5. **Independent resilience and capacity**: Provision each environment to meet production availability and scaling requirements, including placement across Availability Zones. For cross-Region promotion, validate dependency availability, data replication, and write ownership before switching traffic.
6. **Observable promotion gates**: Use automated tests and measurable thresholds for errors, latency, and business outcomes to decide whether to promote or roll back. Include a post-cutover observation period before retiring the previous environment.

## Cloud services for Blue-Green Deployments

Amazon ECS or Amazon EKS supplies the container runtime for the two application versions, while Elastic Load Balancing provides health-aware application routing. AWS CodeDeploy can coordinate supported ECS blue-green deployments; EKS uses Kubernetes routing and deployment automation instead. Amazon Route 53 can move DNS traffic between environment endpoints, including across Regions, with caching constraints. Amazon CloudWatch provides signals for promotion gates and rollback decisions. Together, these services support controlled release transitions, but engineers must still design database compatibility, session handling, multi-AZ capacity, and cross-Region data consistency.

- **[AWS CodeDeploy](https://blowstack.com/tools/cloud-services-hub/aws-codedeploy)**: CodeDeploy orchestrates blue-green deployments for supported compute platforms, including Amazon ECS. For ECS, it coordinates replacement task sets, load balancer traffic shifting, validation hooks, and configured rollback behavior; it does not manage Kubernetes blue-green deployments on Amazon EKS.
- **[Amazon Route 53](https://blowstack.com/tools/cloud-services-hub/amazon-route-53)**: Route 53 can change DNS routing between environment endpoints, including endpoints in different AWS Regions. Weighted routing supports gradual exposure, but DNS caching means traffic movement and rollback are not immediate or precisely proportional at the request level.
- **[Amazon CloudWatch](https://blowstack.com/tools/cloud-services-hub/amazon-cloudwatch)**: CloudWatch supplies metrics, logs, and alarms for evaluating release health before and after cutover. Deployment automation can use alarms to stop or roll back a release, but the previous environment must remain available and data-compatible.

## Blue-Green Deployments exam questions

Real practice exam questions on Blue-Green Deployments, with the correct answer and its explanation.

### Question 1 (DOP-C02)

**Question:**

A retailer runs a stateless checkout API as an Amazon ECS service on AWS Fargate behind an Application Load Balancer (ALB). Service Auto Scaling adjusts the task count during sales events. The account quotas and subnet capacity can support both the current and replacement task sets at peak demand.

The retailer needs a managed deployment process that starts a separate replacement task set and runs automated checkout transactions against it before any production requests reach it. If validation succeeds, exactly 10% of production traffic must reach the replacement for 5 minutes before the remaining traffic shifts. A CloudWatch alarm for checkout errors must automatically initiate rollback during this interval. The team does not want to maintain custom traffic-shifting orchestration.

Which deployment configuration meets these requirements?

**Correct answer:** Use the ECS CODE_DEPLOY deployment controller with two ALB target groups and a test listener. Run validation through an AfterAllowTestTraffic Lambda hook that reports its result to CodeDeploy. Use CodeDeployDefault.ECSCanary10Percent5Minutes, associate the checkout-error alarm with the deployment group, and enable automatic rollback on alarm-triggered deployment stops.

**Explanation:** CodeDeploy creates the replacement ECS task set and can route test-listener traffic to it before shifting production traffic. The AfterAllowTestTraffic hook can validate checkout transactions and report success or failure. The specified canary configuration shifts 10% of production traffic, waits 5 minutes, and then shifts the remainder. Deployment-group alarms and automatic rollback provide the required response to checkout errors.

## Practice Blue-Green Deployments in a full exam

Questions on Blue-Green Deployments in each practice exam, with every answer option and an explanation for each:

- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 5 questions

## What is Blue-Green Deployments

Blue-green deployment separates installing a release from making that release serve production traffic. The blue environment runs the current application, while a separate green environment runs the proposed replacement. Engineers validate green, prepare it for production load, and then change routing so requests reach green. Blue remains available for a defined rollback window before its resources are removed or reused. The colors are labels, not fixed lifecycle states; either environment can become the active production environment.

In cloud architectures, an environment might consist of virtual machines, container tasks, Kubernetes workloads, configuration, and supporting infrastructure. The environments need equivalent behavior and sufficient isolation, but they do not necessarily require separate accounts, clusters, or databases. Infrastructure as code helps keep networking, permissions, health checks, and configuration consistent. Validate dependency access and business transactions as well as basic process health before promotion.

For example, an Amazon ECS application can run its current and replacement task sets behind separate load balancer target groups. A deployment workflow starts the replacement tasks, waits for health checks, optionally exposes a test listener, and then shifts production traffic. With Amazon EKS, engineers can run separate Deployments for the two versions and switch a Kubernetes Service selector or ingress routing configuration. A Kubernetes rolling update is not automatically blue-green: it normally replaces replicas incrementally rather than retaining two separately promotable versions.

Each environment should satisfy the application's Availability Zone resilience requirements independently. Distribute tasks or pods across zones and ensure the receiving environment can handle production traffic with the required failure headroom. Check compute quotas, IP address capacity, load balancer configuration, and autoscaling limits before creating the replacement. Duplicating application capacity temporarily increases cost, and shared databases or external APIs may experience additional load during testing and warm-up.

Blue-green deployment can also support a release between AWS Regions, but it does not itself provide multi-Region resilience. The destination Region needs working dependencies, secrets, certificates, sufficient capacity, and an appropriate data replication design. Define recovery time and acceptable data loss, account for replication lag, and control which Region can accept writes. DNS-based cutover is not instantaneous because resolvers and clients cache answers; routing changes also do not move established connections.

State is usually the hardest part of rollback. Both application versions may share a database, so use backward-compatible expand-and-contract schema changes and postpone destructive migrations until the rollback window closes. Switching traffic back does not reverse writes already made by the new version. Externalize session state where appropriate, drain connections deliberately, and handle background workers separately to avoid unintended concurrent processing or duplicate side effects.

Finally, define promotion and rollback criteria using error rates, latency, resource saturation, and business metrics. Retaining blue makes recovery faster only while it remains healthy, adequately provisioned, and compatible with current data. Blue-green describes the environment arrangement; canary and linear strategies describe gradual traffic exposure and can be combined with it. Neither the pattern nor an all-at-once routing change guarantees zero downtime, so test cutover, rollback, and failure behavior under realistic load.

## Learn Blue-Green Deployments in lessons

2 short lessons on Blue-Green Deployments in 1 certification course.

- DOP-C02: Blue-Green Deployments: container environment cutover (Premium), https://app.blowstack.com/lessons/blue-green-deployments-container-environment-cutover-dop-c02
- DOP-C02: Blue-Green Deployments: cross-Region cutover (Premium), https://app.blowstack.com/lessons/blue-green-deployments-cross-region-cutover-dop-c02
