AWS CodeDeploy Blue/Green with ASG - Failed Deployment Keeps Restarting EC2 Instances

1.4k Views Asked by At

My test application has 3 EC2 instances.

After a failed deployment, I noticed that the ASG keeps bringing back the failed instances.

So after 3 failed deployments, I now have 12 instances running: 9 from the failed deployments, 3 from the live servers.

How do I stop this from happening? Thanks.

3

There are 3 best solutions below

0
On

Ok turns out it is simple ... I needed to go into the ASG settings and delete the ASGs manually

Looks like each CodeDeploy deployment creates an ASG

0
On

CodeDeploy will not delete the autoscaling group. The way the integration works is that if CodeDeploy fails to deploy to an ASG instance, ASG will terminate the instance and try to launch a new one and start a CodeDeploy deployment on the newly launched instances. This eventually gets into a loop and you can either delete the ASG or suspend the scaling process to prevent further scale ups.

0
On

According to this thread: https://forums.aws.amazon.com/thread.jspa?threadID=265522 they (AWS) have an backlog item to implement a way to delete automatically the ASG if the deployment fails but for know they suggests a creation of a lambda function that's delete it triggered by a failed deploy.