0
votes

I am performing AWS CodeDeploy B/G deployment using swapping the autoscaling groups method. For this, I have created one autoscaling group with two instances. Next I have craeted two target groups originaltargetgroup and replacementtargetgroup. Then I have created an application load balancer with listeners as originaltargetgroup(100% traffic) and replacementtargetgroup(0% traffic). When I initiated B/G deployment in codedeploy with target group as replacementtargetgroup it created an copy of original autoscaling group with two new replacement instances.

My question is that I was unable to access the two new green instances with ELB DNS. I figured out that it is because the green instances were placed in replacementtargetgroup which is serving 0% traffic.

Why the ELB didn't switch all the traffic to replacementtargetgroup or maybe I am doing something wrong.

Basically I am confused how the above architecture works. Do I have to create only 1 target group or two target groups for B/G deployments. I am totally confused and can't able to figure it out.

1
How are you switching the target group? - Stargazer
@Stargazer that's what I am not able to figure out how do I switch target groups or should I create only 1 target group? Please help. - marshmello
@Stargazer thanks for the docs but that is not my question based on. I am unable to figure out the architecture of B/G deployment by swapping autoscaling groups. Could you please help in regarding the architecture setup such as how to perform one? How to switch target groups? - marshmello
I would create an entire different setup, with a new load balancer and instance group, and swap the route 53 pointer. - Stargazer

1 Answers

0
votes

Blue/Green deployment with CodeDeploy does not need to have 2 ASGs and 2 Targets group. You only have to provide input as your existing AutoScalingGroup and existing ElasticLoadBalancer.

When you trigger B/G deployment, below sequence is triggered:

  1. A new AutoScalingGroup is created by CodeDeploy, which is the exact replica of your existing ASG.
  2. Once above steps is completed, you are served with new EC2 instances. If existing ASG had 2 EC2 servers, the new ASG will also have 2 EC2 servers running.
  3. When new EC2 servers are provisioned, a deployment is carried out on these servers so that application on them is updated to the new version.
  4. After deployment is completed, the new servers are registered to existing TargetGroup.
  5. After new instances are registered and they are healthy, traffic is rerouted from old servers to new servers.
  6. Post this, old servers are deregistered.
  7. When old servers are deregistered, CodeDeploy can terminate them based on configu