I was performing AWS Blue/Green deployment to test a basic apache server and as CodeDeploy goes through 4 steps of B/G deployment it stuck at step 3 i.e, Routing traffic to replacement instances for about half-hour. I am not able to figure out what's wrong even after spending a long time and a couple of retries. I don't know whether my setup is correct or not. Here is my setup for B/G deployment.
orginalautoscalinggroup
with two instances.originaltargetgroup
& replacementtargetgroup
.originaltargetgroup
to be a part of originalautoscalinggroup
.apploadbalancer
and attached it with originaltargetgroup
apploadbalancer
is attached with originaltargetgroup
which is attached with the originalautoscalinggroup
.My Codedeploy B/G configuration looks like this.
originalautoscalinggroup
originaltargetgroup
I think I am not able to attach correct load balancer or target group. Please help.
Adding answer based on comments.
Since the B/G deployment is failing during traffic rerouting, specifically at "Allow Traffic", instances are in "Unhealthy" state.
If the required services are not running on EC2 and are not reachable, they will remain in unhealthy state and traffic cannot be redirected to them, hence deployment will fail.
To make sure required services/processes are running on EC2 servers started by AutoScaling group, you
This way, whenever a new EC2 is started by ASG, it will go into healthy state depending on time required to start the process. Once it is healthy, it will be ready to server the traffic and post that, old instances will get de-registered.
Once old instances are de-registered, they may get terminated based on configurations in CodeDeploy.