Reputation: 1635
Is it possible to scale AWS ECS tasks based on an external parameter?
I have hosted a service on AWS ECS and it is running with 2 ECS tasks. I want to scale-out the tasks based on some count that I get from a different service.
Would it possible for AWS ECS to scale the tasks based on the count that is returned from an external parameter/service?
Where do I have to publish this count to auto scale the containers?
Upvotes: 2
Views: 1163
Reputation: 2974
I believe you are looking for this:
How to achieve fast, scalable, robust & cost optimized scaling of tasks on AWS ECS
Had exactly a similar requirement where fast scale out was needed based on request count. The biggest challenge was to ensure that AWS auto-scaling does not 'kills' tasks that were still not done, and subsequently scale down quickly to avoid compute cost. The solution is built on event driven architecture and is quite cheap to run.
Upvotes: 0
Reputation: 1635
I did some research and found an alternate (Cheaper) solution to custom cloud watch metric.
In order to publish custom metric, you are going to do a recurring operation to poll the external parameter and send it to AWS.
Instead, you can use the same recurring operation to poll the parameter and scale-in or out ECS tasks using ECS UpdateService API
You can set the desired count through updateService request and increase or decrease the count of your tasks based on the external parameter.
It will save you the cost of putting cloud watch metrics.
Upvotes: 2
Reputation: 239000
Yes, you can do this through Application Auto Scaling for ECS. Specifically you can setup target tracking scaling policy with a custom CloudWatch metric.
So basically, you would have to create a custom metric based on the data from the external provider.
Upvotes: 3