A way to reduce the wait time of "aws ecs wait services-stable"

Viewed 1478

Is there a way to reduce the time for a service to get recognised as being stable? I have a deployment pipeline set up via Jenkins. The build time is ~8 minutes only due to this last step

aws ecs wait services-stable --cluster $C --service $S

which roughly takes 5-6 minutes. The target group is set up to be healthy after 2 checks. The check is done every 20 seconds, so this should get flagged as healthy after 40 seconds if I'm not mistaken.

2 Answers

I found the issue was related to my load balancer's target group Deregistration delay.

(From the gui)

This was set to 300 seconds.

This was set to 300 seconds.

I also found the answer in here: https://forums.aws.amazon.com/thread.jspa?threadID=257357

To quote one of the relevant answers.

Are you using target groups? My first thought is it's draining and waiting for a state change from that. Default deregistration_delay.timeout_seconds timeout is 5 minutes.

There is a fantastic article about Speeding up Amazon ECS container deployments that includes answer to this question and offers other ways to speedup deployments. Regarding this settings, if you have a classical REST API app, then you can reduce this settings deregistration_delay.timeout_seconds to 5 sec.

https://nathanpeck.com/speeding-up-amazon-ecs-container-deployments/

Related