'Is it possible to temporary disable ECS Service to start new tasks once some tasks are stopped?
I have Ruby on Rails application running on ECS. Each Service has it's own desired count. I'm using ECS Ruby SDK and Resque/Redis.
Every task should take a job from queue (Resque/Redis) and once it's finished it should take another job.
But there are situations in which there are no jobs in the queue. In that case i want to decrease the number of running tasks. There is a way to do this from ECS Ruby SDK:
tasks_to_stop.each do |task|
ecs.stop_task(task[0]['id'])
ecs.update(ecs.current_desired_count - 1)
resque.remove_worker(task[0]['ip'])
end
In this case i loop through each task (specific task id from ECS that is not running any job) and i kill that task and after that i decrease desired_count by 1.
In most cases this will work but i can't be sure about that since some times there is a delay when i call stop_task method. It would be great if there was a way to tell ECS Service to temporary disable starting new tasks even if the number of running tasks is not the same as desired count.
Is there a way to do this from ECS GUI, AWS CLI or ECS Ruby SDK?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
