1

I am trying to build something in Terraform(but the tooling isn't relevant here) to scale ECS on Fargate based on number of messages in an SQS queue. I've got it working so far for if the number of messages visible in SQS exceed 1000, then it will scale up by 5 tasks on ECS. I've managed to do this with Step scaling, but then it would scale + x tasks on ECS if number of messages in an SQS exceed a certain count.

I wanted to know if it is possible to scale with x number of workers for every certain amount of increaase in messages. So for example could I make it scale one 1 ecs task for every 1000 messages increase on the SQS queue.

So for example if I had 1001 messages 1 task would be added, if I then had + 8000 increaase in messages in the sqs queue that it would add 1 ECS task for each thousand message increase which would mean 8 ecs tasks would be added since the number of messages increased by 1000 for 8 times.

I hope my question makes sense.

I've read over the Autoscaling docs and tried googling the question, but struggling to know if this is possible. Would this kind of thing be possible? Thanks for your help.

OpenBSDNinja
  • 1,037
  • 10
  • 18
  • The question could be applied to another cloudwatch metric for example request count. Would it be possible to scale for every x increase in request count to then scale up by x amount of tasks on ECS? – OpenBSDNinja Dec 09 '20 at 10:00

1 Answers1

1

You can use per target metrics to scale tasks but I'm not 100% sure about being able to link to the number of messages in a SQS queue.

All the other per target metrics are based off properties of that target.

Info can be found here in the AWS docs

Jonathan Irwin
  • 5,009
  • 2
  • 29
  • 48