My AWS Batch job fails, and I receive a "Getting error Too Many Requests" error.
Short description
AWS Batch throttles all API requests for AWS accounts based on an account's AWS Region. This makes sure that AWS Batch maintains consistent performance and fair usage for all customers. AWS Batch API quotas typically apply to every API, including the DescribeJobs and SubmitJob API calls.
Note: The maximum number of transactions per second (TPS) for each account for SubmitJob operations is 50.
When you reach your AWS Batch API quotas, AWS Batch returns the following error message:
"Getting error Too Many Requests (Service: AWSBatch; Status Code: 429; Error Code: TooManyRequestsException)."
There are two common reasons that Getting error Too Many Requests errors occur:
- Submitting multiple jobs at the same time programmatically, using the AWS Command Line Interface (CLI) or AWS SDKs
- Using AWS Lambda to submit multiple jobs
Resolution
As you troubleshoot the error, keep the following points in mind:
- API quotas apply only to AWS endpoints. These quotas don't apply to your account.
- AWS throttles Amazon API requests on a per-Region basis to prevent individual accounts from flooding the service endpoints with too many requests.
- AWS makes sure that all calls to all Amazon APIs don't exceed the maximum allowed API request rate. The maximum API request rate varies across Regions.
Use retries and an exponential backoff algorithm with jitter, and then resubmit your job
For more information, see Exponential backoff and jitter.
Use AWS Batch array jobs to submit multiple jobs with a single SubmitJob API call
For more information, see Array jobs and SubmitJob.
Note: AWS Batch array jobs allow you to submit up to 10,000 copies of a job.
Adjusting API throttling quotas
You can request an increase for API throttling quotas for your AWS account. To request a quota adjustment, contact the AWS Support Center