amazon-web-servicesamazon-ecsaws-auto-scaling

Scale In and Out ECS tasks based on external parameter


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?


Solution

  • 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.