Retzah
Retzah

Reputation: 31

How to define rate limiting for ECS fargate service?

I am developing a service using ECS on fargate. This service calls AWS textract to process documents. The service listens to a SQS with requests to process.

As per textract documentation: https://docs.aws.amazon.com/general/latest/gr/textract.html, there is a limit on TPS per account at which the textract apis can be called.

Since there are "no visible instances" in fargate and all architecture from launching instances to auto scale them is managed by fargate, I am confused on how should I define rate limiter while calling AWS textract apis. For instance suppose there comes 1000 message requests in the SQS, the service(internally) might spawn multiple instances to process the requests and the TPS at which textract is called might easily exceed the limits.

Is there any way to define a rate limiter for such scenario such that it blocks the request if limits are breached?

Upvotes: 1

Views: 2001

Answers (1)

Mark B
Mark B

Reputation: 200900

Fargate doesn't handle autoscaling for you at all. Your description of how Fargate works sounds more like Lambda than Fargate. ECS handles the autoscaling, not Fargate. Fargate just runs the containers ECS tells it to run. In ECS you would have complete control over the autoscaling settings, such as the maximum number of Fargate tasks that you want to run in your ECS service.

Upvotes: 1

Related Questions