How do I monitor the usage of my AWS API calls using Amazon CloudWatch?

Last updated: 2022-03-30

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?

Short description

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.

Resolution

Use this method to check and monitor your usage for all AWS resources that publish usage metrics. This example uses the PutMetricData.

  1. 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.
  2. Open the CloudWatch console.
  3. In the navigation pane, choose Metrics, and then choose All metrics.
  4. 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.
  5. Choose the metric CallCount. This metric gives a count of the number of times that an API operation is made.
  6. 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.
  7. 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.

  8. To view your current usage, choose Add math, and then choose Start with empty expression.
  9. In a new row, enter the following:
SERVICE_QUOTA(m1)

Did this article help?


Do you need billing or technical support?