Understanding Blue-Green Deployments in AWS

Blue/Green Deployment in AWS

Applications developed are subjective for constant upgrading and updates. Developers roll out new features that are needed to be deployed on the environment. Deploying a new code/feature to a perfectly running application is a sensitive process, which can result in unexpected errors or complete breakdown in the worst case. To avoid such scenarios, the concept of Blue-Green was developed.

What is Blue-Green?

Blue-Green deployment is a deployment strategy, where we have another environment identical to production, and deployment is carried on this environment. The live environment is termed as ‘Blue’ and new identical environment is ‘Green’. Deployment is performed on the Green environment. If the deployment is successful and no errors are detected, then the traffic is shifted to ‘Green’. The biggest advantage of this deployment is no downtime. Application is up and running even in the deployment and the end user hardly get to know about the deployment.
In AWS, Blue-Green deployment is possible with CodeDeploy and Beanstalk.
CodeDeploy offers various configurations - 
  • You can create your green fleet manually or codedeploy creates a copy of the auto-scaling group.
  • You can deploy on various compute platforms - EC2/OnPremise, Lambda and ECS platform.
  •  For EC2/OnPremise platform, deployment configuration could be-

    -OnAtaTime - Deployment is performed on instance at a time.If A,B,C and D are 4 servers, deployment is performed on A first, then B, and so on.

    -HalfAtaTime - Instead of performing deployment on complete Green fleet, deployment is carried on half of the fleet at a time. For example, if there are 4 servers in the replacement fleet, deployment is performed on 2 servers first and then the other two.
    -AllAtOnce - Deployment is carried on the complete fleet simultaneously.  

  •  You can easily rollback to the previous configuration until your blue fleet is terminated. 
  •  You can select when to initiate traffic to the green fleet. You can specify wait time in the deployment group of code deploy. This is the time for which code deploy waits before routing traffic to green fleet. 

Once the deployment is completed on the Green fleet, tested and verified, the traffic is shifted to it. CodeDeploy then terminates the Blue Fleet.
Deployments are made automatic using this approach. If the ec2-instance is under autoscaling, and a new instance is launched as a scaling activity, the application is automatically deployed to that instance. This time codedeploy is triggered by autoscaling.
In this way, deployments can be done without any downtime using CodeDeploy. CodeDeploy is a really good service offered by AWS.

Recommended Ebook

Printing in C# Made Easy

Download Now!
Similar Articles