Amazon SQS - Amazon ECS AWS Fargate - Target Tracking Scaling Policy

Amazon SQS → AWS Fargate

This pattern creates an ECS Fargate application that consumes an Amazon SQS queue and it scales on the basis of queue size

This sample project demonstrates how target tracking scaling policy works with an ECS Fargate application
We have a python application under consumer/app.py that consumes messages from an SQS queue. The application is containerised and the image is pushed to an ECR registry.
On the basis of a target value of the SQS metric - ApproximateNumberOfMessagesVisible, the count of tasks of the cluster will increase.
Again, when the actual value drops below the target value, the count of tasks comes down to the initial value.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/sqs-ecs-autoscaling

Deploy

sam deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.

Created by:

Saborni Bhattacharya

Saborni Bhattacharya

AWS SA, Cloud Enthusiast

Follow on LinkedIn