How can I avoid Route 53 API throttling errors?

3 minute read
0

I'm getting API throttling errors in Amazon Route 53.

Short description

When you perform bulk API calls to Route 53, you might receive an HTTP 400 (Bad Request) error.

A response header with a Code element value of Throttling and a Message element value of Rate exceeded indicates rate throttling. Rate throttling happens when the number of API requests is greater than the hard limit of five requests per second, per account.

If Route 53 can't process the request before the next request for the same hosted zone, then it rejects subsequent requests with another HTTP 400 error. The response header contains both of the following elements:

  • A Code element with a value of PriorRequestNotComplete
  • A Message element with a value of the request was rejected because Route 53 was still processing a prior request.

API calls from AWS Identity and Access Management (IAM) users in the same account count towards global rate throttling for the account. API calls from these IAM users also impact API calls that are made from the AWS Management Console.

Resolution

Note: If you receive errors when running AWS Command Line Interface (AWS CLI) commands, make sure that you're using the most recent AWS CLI version.

To avoid rate throttling, use any of the following methods:

Batching requests

To reduce API calls, use the AWS CLI or your preferred SDK to group individual operations of the same type into one change batch operation.

For example, request to CREATE, DELETE, or UPSERT (update and insert) several records with one batch operation. Use the change-resource-record-sets command in the AWS CLI to perform bulk resource record operations.

Note:

  • UPSERT requests count twice.
  • There are quotas for the elements and characters in change-resource-record-sets API calls.

Use error retries and exponential backoff

To avoid throttling, add error retries and exponential backoff to your Route 53 API calls. For example, use a simple exponential backoff algorithm that retries the call in 2^i seconds, where i is the number of retries.

Randomize start times

Randomize the start time for calling Route 53 APIs. Be sure that there aren't multiple applications that are processing the logic at the same time. Simultaneous requests might cause throttling.

Introduce "sleep time" between calls

If the code function calls to Route 53 APIs are consecutive, then add "sleep time" between the two calls to minimize the risk of throttling.

AWS OFFICIAL
AWS OFFICIALUpdated 10 months ago