1

We have a task that loads some configuration from database. After the settings are updated on db we would like to be able to restart all the tasks in a service so that the settings propagate to all instances.

I used

aws ecs update-service --force-new-deployment --cluster CLUSTER_NAME --service SERVICE_NAME

But this causes downtime. As this stops and start

BalaB
  • 111
  • 1
  • 5

2 Answers2

1

Best to scale out your ECS Service, e.g. from 10 to 20 tasks, and once they're up scale down again to 10, that will kill the obsoleted ones.

Check out ECS Rolling Updates.

Hope that helps :)

MLu
  • 24,849
  • 5
  • 59
  • 86
1

This sounds like you have not configured or don't have proper health checks. With this ECS can gracefully remove tasks from the load balancer and only add new tasks when they are ready.

Simply expose a GET that returns a HTTP 200 in your application and use ECS to actively check if your task is running before sending traffic to it.

ECS will try make sure that there is a minimum healthy percent when doing a rolling update.

I restart our clusters this way without downtime.

rjdkolb
  • 111
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Dec 07 '22 at 16:47