I receive a "Rate exceeded" error message when I try to create, update, or access an AWS service. How can I monitor the number of AWS API calls I make using Amazon CloudWatch metrics to prevent "Rate exceeded" errors?
There is a limit on the number of AWS API calls that you can make per second. After you exceed this limit, you receive a Rate exceeded error, and further API calls are throttled. For more information on determining the API call that is causing a Rate exceeded error, see How can I find which AWS API call is causing a "Rate Exceeded" error?
If you are using API calls in automation, it's a best practice to monitor your usage to avoid Rate exceeded errors. Amazon CloudWatch collects metrics that track the usage of some AWS services. These metrics correspond to AWS service quotas. Follow the steps in this article to graph these metrics and visualize your usage.
Use this method to check and monitor your usage for all AWS resources that publish usage metrics. This example uses the PutMetricData.
- Check the default limits of the PutMetricData API call in the CloudWatch service quotas documentation. You can also check your account applied limit using the Service Quotas console.
- Open the CloudWatch console.
- In the navigation pane, choose Metrics, and then choose All metrics.
- Usage metrics are published under the Namespace AWS/Usage. Choose this namespace, and then filter for the API call you want to graph. In this case, choose PutMetricData.
- Choose the metric CallCount. This metric gives a count of the number of times that an API operation is made.
- Choose Graphed metrics, and then choose the time range that you want to check your usage for. In this case, choose the range where you received a Rate exceeded error.
- For Period, choose 1 minute, and for Statistic choose SUM. This gives the total number of API calls made every minute. Note: Most API calls have a limit on the number of API calls made per second. This is measured as Transactions per Second (TPS). For PutMetricData, the limit is 150 TPS.
- To view your current usage, choose Add math, and then choose Start with empty expression.
- In a new row, enter the following:
CloudWatch usage metrics
Visualizing your service quotas