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.
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: