How do you implement Blue/Green deployment in AWS (Part 5/7)

Leon Jalfon
CloudWithMORE
Published in
3 min readOct 14, 2020

In this 7-parts tutorial, we will create an initial environment composed of an autoscaling group with two ubuntu machines behind a load balancer, then we will create a CI/CD pipeline to provide blue/green deployments using CodeBuild, CodeDeploy, and CodePipeline.

Step 5: Configure CodeDeploy

In this section, we will configure CodeDeploy to allow it to manage our application

About CodeDeploy

AWS CodeDeploy automates code deployments to any instance, including Amazon EC2 instances and on-premises servers. AWS CodeDeploy makes it easier for you to rapidly release new features, helps you avoid downtime during application deployment, and handles the complexity of updating your applications.

Configure CodeDeploy

Browse to “Applications” (under Deploy) in the CodeDeploy portal and click on “Create application”

Name it “bluegreen-deploy” and set it to use “EC2/On-premises”

Click on “Create deployment group”

Set the deployment group name as “bluegreen-deploygroup”

Choose the IAM role “bluegreen-codedeploy-role”

Select “Blue/Green” as deployment type

Choose “Automatically copy Amazon EC2 Auto Scaling group” and set the auto scaling group “bluegreen-tg”

Under deployment settings configure the below:

  • Reroute traffic immediately
  • Terminate the original instances in the deployment group
  • Deployment configuration: CodeDeployDefault.AllAtOnce

Select “Application Load Balancer” and choose the target group “bluegreen-tg” and click on “Create deployment group”

Finally click on “Create deployment” to trigger a new deployment (manually)

Choose the deployment group, select the last github commit and trigger the deployment

Then you will be redirected to the deployment portal and you will be able to track the process

Wait until the deployment finish and browse to the load balancer DNS

Next: How do you implement Blue/Green deployment in AWS (Part 6/7) [Will be available soon]

--

--