How do I keep my Auto Scaling API calls from being throttled?

4 minute read

My application receives "Rate Exceeded" errors when the application calls to Amazon EC2 Auto Scaling, AWS Auto Scaling, or AWS Application Auto Scaling.

Short description

API calls can't exceed the maximum allowed API request rate per AWS account and per AWS Region. This includes API calls from the AWS Command Line Interface (AWS CLI) and the AWS Management Console. If API requests exceed the maximum rate, then you receive a "Rate Exceeded" error, and further API calls are throttled.

Amazon EC2 Auto Scaling, AWS Auto Scaling, and AWS Application Auto Scaling have their own API throttle buckets. This means that all Amazon EC2 Auto Scaling API calls have a single, shared API limit. Amazon EC2 Auto Scaling API calls don't affect the limit for AWS Application Auto Scaling APIs.

To avoid the "Rate Exceeded" error and throttling, verify that your application makes only necessary calls.

Note: If you receive errors when you run AWS CLI commands, then see Troubleshoot AWS CLI errors. Also, make sure that you're using the most recent AWS CLI version.


Check current Auto Scaling API Usage

To check current Auto Scaling API usage, monitor the AWS Usage statistics in your Amazon CloudWatch metrics for the EC2 Auto Scaling service. Use the metrics to monitor the Auto Scaling APIs that are called, and identify times with large numbers of API calls or "Rate Exceeded" errors. Then, use this information to optimize and reduce your API usage.

Validate "describe" calls

Excessive describe calls contribute to the total API requests that are measured against the allowed request rate. Verify that your application describe calls are all necessary, and use other solutions if possible. For example, use push notifications from Amazon EventBridge to send notifications when instances change state, such as when they start a lifecycle hook.

Applications that check the lifecycle state of the instance don't make a describe call. Instead, these applications query instance metadata. Retrieve tag information, including the name of the Auto Scaling group, from instance metadata. You must use the launch template to turn on tag information for the instance.

Check calls from third-party applications

Third-party applications might make continuous calls to Auto Scaling in AWS. Review your third-party applications for unnecessary calls, and update the settings of your third-party applications.

Implement error retries and exponential backoffs

Error retries and exponential backoffs can help limit the rate of API calls. Each AWS SDK implements automatic retry logic and exponential backoff algorithms. For more information, see Retry behavior.

Avoid bursts of activity

Avoid situations that cause bursts of API calls. For example, When you launch instances in an Amazon EC2 Auto Scaling group, don't set the instances to turn on scale in protection. Turn on the option by default for the Auto Scaling group so that all instances have protection.

Request a service quota increase

To get a service quota increase, request an increase from the Support Center console. Under the Service Limit Increase section, complete the following steps:

  1. For Limit type, choose Auto Scaling.
  2. For Auto Scaling Service, choose EC2 Auto Scaling.
  3. For Limit, choose API throttling.
  4. For New limit value, choose N/A.

Include the following information in the request:

  • Validation of your API call rate and the implementation of error retires or exponential backoff methods
  • Region and timeframe related to the throttling issues
  • Full workflow of the AutoScaling APIs
  • When you expect your peak API usage to happen, such as during a deployment

For more information, see How do I manage my AWS service quotas?

Related information

Exponential backoff and jitter

AWS service quotas

AWS OFFICIALUpdated 6 months ago