I have an existing service with 2 tasks running. I updated the existing service with a new task definition and the old one was dergistered. The new task failed to come up but the old tasks were killed and the service tried to bring up the new tasks but it failed. This leads to a situation when there are no tasks running at all. The reason the new tasks were not able to come up was because of a bug in my code. But, shouldn't ECS have ensured that the old healthy tasks were still running when the new ones where not up.
When does ECS decides to kill the old tasks? I understand it is when the task status goes to "Running". Does "Running" means, it is healthy? On further debugging, I found that the problematic task was in running state for some time.