Blue-Green is a deployment technique that keep 2 production environments running but only one of the environment is live and one is idle. As you prepare a new version of your software, the current production (Blue) is serving all production traffic. You also have another environment running the new software. Once it has been fully tested (Green), you switch the traffic to route to the Green environment instead of Blue. Now Green is live and Blue is idle.
This technique can reduce the downtime and risks. If there is unexpected issues with Green then you can switch the traffic back to Blue.
This sample code is made available under a modified MIT license. See the LICENSE file.
We will be create a Cloud9 environment to do development. We will use CloudFormation to build our infrastructructure consisting of VPC, public and private subnets, Application Load Balancer and AutoScaling Group. We will use CodePipeline for CICD which utilize CodeCommit, CodeBuild and CodeDeploy. In CodeDeploy we will configure Blue/Green Deployment.
- Create Cloud9 environment.
- Create a repository for your code and commit you first code.
- Create infrastructure (ALB, ASG, EC2 and S3).
- Create Build project with CodeBuild and store build artifact in S3.
- Create Application and Deployment group to deploy the artifact to AutoScaling Group with Blue Green deployment.
- Create CICD with CodePipeline.
Follow the Detail Instruction here.