Will ECS terminate a task if health check fail during service update termination phase?


If I have health check defined for 30 second interval and 3 failures allowed and termination grace period for task set to 3 minute. Assuming that on SIGTERM due to service update, I stop receiving new requests and task takes 150 seconds to gracefully stop, will ecs terminate my container after 90 seconds since its health checks will fail due to webserver not responding to new requests.

This is a concern because I had similar issue with k8s https://github.com/kubernetes/kubernetes/issues/107473

asked 2 years ago889 views
1 Answer

From experience, ALB/NLB reports the status of the target to ECS to indicate to stop the task. So with the 30x3 you mentioned, that's 90 seconds the task will have been running. That does not take away the StopTimeout set for the container on SIGTERM. So in total your task will be running 90 seconds + (30s (default for StopTimeout) to SIGKILL || graceful shutdown -> which ever comes first.

profile picture
answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions