DEV Community

Cover image for How To Migrate Load Balanced Application by Using a Blue Green and Canary Deployment Strategy
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

How To Migrate Load Balanced Application by Using a Blue Green and Canary Deployment Strategy

Step 1. Create resources by using cloudformation template

  • Click Next

  • Click Next

  • Click Submit

  • Wait until Create_Complete

Step 2. Configure the blue deployment

  • Click Target Groups

  • Click Blue

  • Click Register targets

  • Select Blue EC2 and Click Include as pending below

  • Click Register pending targets

  • Wait Health status as Healthy

  • Click Load Balancer

  • Click BlueGreenALB

  • Click 1 rule

  • Check that the Forward to value is Blue: 100 (100%).

  • Click BlueGreenALB

  • Copy DNS and paste in new tab

Step 3. Configure the green deployment

  • Click Target Groups

  • Click Green

  • Click Register targets

  • Choose Green EC2

  • Click Register pending targets

  • Click Load Balancer

  • Click BlueGreenALB

  • Select HTTP:80 and Click Manage rules and Edit rules

  • Select Default and Click Actions and Edit rule

  • Click Add target group

  • Choose Green and Update Weight and Click Save change

  • Click Refresh Icon

  • Click BlueGreenALB

  • Copy DNS and paste in new tab

  • If stable, change weight to 50% and test DNS again

Step 4. Change route all traffic to the Green target group by using a CloudFormation change set

  • In the AWS Management console, on the navigation bar, type and select the CloudFormation service.

  • Select Blue-Green-and-Canary-Deployment and click Stack actions and Create change set for current stack

  • Choose Edit in Application Composer and Click Edit in Application Composer

  • Click Go to Desinger

  • Select and delete the BlueWebServer1 and BlueWebServer2 resources.

  • In the BlueGreenALBListener resource, in TargetGroupArn, change the value to !Ref GreenTargetGroup.

  • Delete BlueTargetGroup

  • Click Refresh, Validate and Save Icon

  • Select Replace existing template and Click Next

  • Write RemoveBlueEC2andTargetGroup and Click Next

  • Click Next

  • Click Submit

  • Check In the Changes section,the change will remove the BlueTargetGroup, BlueWebServer1, and BlueWebServer2 resources, and modify the BlueGreenALBListener.

  • Click Execute change set

  • Click Execute change set and Wait until Update_Complete

  • Click Load Balancer

  • Click BlueGreenALB

  • Copy DNS and paste in new tab


Resources & Next Steps


Top comments (0)