How does Blue/Green deployment work with AWS?

Vinay Patil
Posted by Vinay Patil on July 7, 2017

In one of our projects, we were working on the production upgrade of a large web application. The process involved upgrading multiple services and its components on different servers of the web application. With the traditional approach, the application had to be stopped for a certain maintenance window and redeployed with the latest code, services, and components. The main hurdle was to debug the application after upgrades and enable rollback to the previous stable version in case of failure. We were able to provide an optimal work around in time and stabilize production environment of an application within the maintenance window. This upgradation was possible with the adoption of Blue/Green deployment.

So what exactly is Blue/Green deployment?

Blue/Green deployment is a technique designed to reduce the complexity of production system upgrades. At its core, it involves running two identical environments called “blue” and “green”. The current environment is called "blue", and the other environment is the “green” environment which runs in parallel with the live environment. The main focus is to perform the upgradation process to the latest version by shifting the traffic between environments with ease while releasing an upgrade. The process offers incremental updates to your production stack with zero downtime and with less complexity for managing the rolling updates.

Blue/Green deployment methodology provides separate platforms for deploying your application infrastructure. It offers flexibility for users to provision a green application environment in parallel to the existing blue environment. Furthermore, it helps to minimize the deployment risk and provides ample amount of time to perform validation on the new environment. If the validation test fails or there is any unexpected behavior, you can dispose of the environment without affecting the live blue production environment. Designing Blue/Green deployment based CI/CD pipelines help to minimize deployment complexities and assure same deployment procedure across all the environments like dev, staging, and pre-prod.

AWS enables organizations to manage such deployments in a cost-effective and low-risk way during a major push to production.

What are the AWS services used in Blue/Green deployments?

AWS provides a number of services such as AWS Elastic beans, AWS Opsworks, AWS CloudFormation, Amazon Route 53, Elastic Load Balancing, EC2, RDS, and Auto scaling to automate application deployments. You can access these resources using API, and SDKs along with different configuration management tools like Ansible, Chef, and Puppet.

Amazon Route 53 - Route 53 is a highly available and managed DNS service that provides domain registration. It allows administrators to automatically modify endpoints (e.g. ELB) and to assist in failover strategies. The traffic is redirected by simply updating DNS records in the hosted zone.

CodeDeploy - CodeDeploy enables automation of the deployment workflow. It is a part of the new application lifecycle management (ALM) tools provided by AWS that include CodePipeline and CodeCommit. It also enables easy roll out of deployments across a fleet of AWS resources.

AWS CloudFormation - CloudFormation provides a JSON-based DSL for provisioning AWS resources. These JSON formatted templates enable provisioning of AWS resources such as EC2, Route 53, VPC, security groups, ELBs, RDS, S3, Auto Scaling, and IAM etc.

AWS Elastic Beanstalk - AWS Elastic Beanstalk is a simple and easy way to deploy an application on AWS. It supports Elastic load balancing and Auto-scaling which help in Blue/Green deployments. This enables running different versions of applications and also provides out of the box capabilities to switch from one environment to another by swapping the URLs.

AWS resources can be integrated into the CI/CD pipeline or when deploying applications. The application deployment architecture consists of a Route 53 DNS running with an Elastic load balancer. It also consists of containerized applications that have multiple microservices running on the ECS. The AWS RDS simplifies the sharing of DB between two different environments enabling developers to adopt Blue/Green deployment.

How does Blue/Green deployment work with AWS?

DNS routing through record updates is a common approach to Blue/Green deployments. With DNS you can easily switch traffic from the blue environment to the green and vice versa if rollback is necessary. Route 53 can be used to perform switch when bringing up the new “green” environment. The switch could consist of a single EC2 instance, or an entire ELB. The resource record set has to be updated so that it points to the domain/subdomain of the new instance or the new ELB. It works for a wide variety of environment configurations, as long as the endpoint is a DNS service or an IP address.

As an alternative to this DNS approach, we can also use Route 53 with alias resource record sets. The traffic can be switched from blue environment to the green environment by updating the alias record of the record set. You can easily rollback to blue deployment in case of an error by updating the DNS record.

Another approach to perform the Blue/Green switch is using the weighted distribution with Route 53. Here you can shift the traffic based on weightage of environment. Amazon Route 53 enables you to define a percentage of traffic for the green environment and gradually update the weights until the green environment carries the full production traffic. This method provides the ability to perform canary analysis that gradually introduces a small percentage of production traffic to the new environment.


Blue/Green deployment operates at its best to enable high availability and continuous delivery. It provides a great way to minimize production impact as well as reduces risk by allowing testing prior to the release of a new version to the production environment. It simplifies the complexities involved, thereby achieving zero-downtime deployments and a fast rollback mechanism. Cloud providers such as AWS provide us the ability to easily create new environments and impart different options to implement Blue/Green deployments.

We will be discussing the tools, services, and strategies for Blue/Green deployment with AWS in detail in part 2 of this blog. Stay tuned!

Topics: Cloud, DevOps, & Containers, AWS, Load Balancing, Cloud, Ansible, CI/CD, Blue/Green Deployment, DeploymentTools

Leave Comment

Subscribe Email

    Post By Topic

    See all