ECS CloudFormation Taking Forever – Just for a Failed Deployment

Introduction
Sometimes times when you are deploying an AWS ECS service using CDK or a CloudFormation stack, you end up in a strange situation where the deployment seems to go on forever. The tasks aren’t deployed, the tasks are failing health checks, a…


This content originally appeared on DEV Community and was authored by Jayson Rawlins

Introduction
Sometimes times when you are deploying an AWS ECS service using CDK or a CloudFormation stack, you end up in a strange situation where the deployment seems to go on forever. The tasks aren't deployed, the tasks are failing health checks, and ECS just keeps starting new tasks.

Sometimes, you can see even the old tasks aren't passing health checks. That's a guarantee that your poor service is going to take forever to fail, according to CloudFormation.

You're waiting and waiting and waiting. You already know how to fix it and are ready to move on; however, CloudFormation just keeps trying in vain. This can be a really frustrating experience.

Person staring at their computer screen

How to Trick CloudFormation Into 'Thinking' It Succeeded
So, a basic way to trick CloudFormation into thinking that everything has been deployed successfully is to simply redeploy the service in the AWS Console.

Yeap, that's right. You can redeploy the service in the AWS Console, but this time, you are going to set the following parameters:

DesiredCount: 0
MinCount: 0
MaxCount: 0

REMEMBER: You are not changing anything else in the service; you are just changing the desired, min, and max count to 0. Also, you don't need to check the box to force a redeployment.

ECS AWS console settings

After all the tasks have been stopped, cloudformation will think that everything has been deployed successfully.

This will allow you to continue debugging your service without waiting hours for cloudformation to timeout or for the number of retries to finally have been exhausted.

This trick has saved me a lot of time and frustration over the years.


This content originally appeared on DEV Community and was authored by Jayson Rawlins


Print Share Comment Cite Upload Translate Updates
APA

Jayson Rawlins | Sciencx (2025-03-13T20:57:34+00:00) ECS CloudFormation Taking Forever – Just for a Failed Deployment. Retrieved from https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/

MLA
" » ECS CloudFormation Taking Forever – Just for a Failed Deployment." Jayson Rawlins | Sciencx - Thursday March 13, 2025, https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/
HARVARD
Jayson Rawlins | Sciencx Thursday March 13, 2025 » ECS CloudFormation Taking Forever – Just for a Failed Deployment., viewed ,<https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/>
VANCOUVER
Jayson Rawlins | Sciencx - » ECS CloudFormation Taking Forever – Just for a Failed Deployment. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/
CHICAGO
" » ECS CloudFormation Taking Forever – Just for a Failed Deployment." Jayson Rawlins | Sciencx - Accessed . https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/
IEEE
" » ECS CloudFormation Taking Forever – Just for a Failed Deployment." Jayson Rawlins | Sciencx [Online]. Available: https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/. [Accessed: ]
rf:citation
» ECS CloudFormation Taking Forever – Just for a Failed Deployment | Jayson Rawlins | Sciencx | https://www.scien.cx/2025/03/13/ecs-cloudformation-taking-forever-just-for-a-failed-deployment/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.