Resolving AWS API Gateway 429 Error

The AWS API Gateway is a versatile service enabling developers to construct, manage, and secure APIs on a grand scale. There are two 429 errors you could get from API Gateway.

The 429 Limit Exceeded Error

The first one is called “Limit Exceeded Exception,” which indicates that you went over an API quota.

API Gateway allows access control via API keys. When creating such a key, you can also define a usage quota such as 1000 requests per week. If this quota is reached, the API gateway will respond with a 429.

Normally a retry doesn’t solve this problem. You either have to increase the quota for the key, or you have to wait until the next usage period starts.

The best way to get around this issue is to keep your API requests monitored and counted. Check how many requests you send and if you really need to send so many. You can also try to cache responses so that you can reuse them instead of sending duplicate requests that count to your key’s quota.

The 429 Too Many Requests Error

The second 429 error is of temporary nature. A 429 status code typically appears when you’ve exceeded a certain limit of requests, which can occur under the following circumstances:

  • Lambda function limitations: If your API endpoint is connected to a Lambda function that has a predefined limit of 1000 concurrent invocations, exceeding this limit will trigger a 429 error. If you attempt 1001 parallel invocations, the API Gateway will return a 429 status code. However, depending on the time this Lambda function takes to process a request, retrying after some time may be successful as a slot could free up.
  • API key limits: API keys can also have request limits. If your key allows for only 10 concurrent requests, any additional parallel requests won’t go through, even if the upstream service can handle more.

To prevent frequent 429 errors, monitor your requests to ensure they are not nearing the service limits. Additionally, try to cache requests on your clients to prevent overloading the API.

How Can I Debug AWS API Gateway 429 Errors?

Debugging the 429 Too Many Requests error in the AWS API Gateway involves using various AWS tools to locate and address the issue.

  • DashbirdMonitor, debug and improve API Gateways seamlessly all in one place. Dashbird offers developers a real-time overview of all API executions, detects errored invocations within them, and enables swift root cause identification. It’s free for the first 1 million invocations per month.
  • CloudWatch logs: Use AWS CloudWatch logs to track, analyze, and store logs from your AWS resources. CloudWatch logs are essential for detecting and diagnosing errors within your API Gateway.
  • X-Ray: AWS X-Ray, AWS’s distributed tracing system, provides visualization and analysis of your applications. It assists in pinpointing areas prone to errors or needing improvement.

With the right tools and strategies, resolving these 429 errors effectively and maintaining optimal API performance is achievable.

Read our blog

Making serverless applications reliable and bug-free

In this guide, we’ll talk about common problems developers face with serverless applications on AWS and share some practical strategies to help you monitor and manage your applications more effectively.

ANNOUNCEMENT: new pricing and the end of free tier

Today we are announcing a new, updated pricing model and the end of free tier for Dashbird.

4 Tips for AWS Lambda Performance Optimization

In this article, we’re covering 4 tips for AWS Lambda optimization for production. Covering error handling, memory provisioning, monitoring, performance, and more.

More articles

Made by developers for developers

Dashbird was born out of our own need for an enhanced serverless debugging and monitoring tool, and we take pride in being developers.

What our customers say

Dashbird gives us a simple and easy to use tool to have peace of mind and know that all of our Serverless functions are running correctly. We are instantly aware now if there’s a problem. We love the fact that we have enough information in the Slack notification itself to take appropriate action immediately and know exactly where the issue occurred.

Thanks to Dashbird the time to discover the occurrence of an issue reduced from 2-4 hours to a matter of seconds or minutes. It also means that hundreds of dollars are saved every month.

Great onboarding: it takes just a couple of minutes to connect an AWS account to an organization in Dashbird. The UI is clean and gives a good overview of what is happening with the Lambdas and API Gateways in the account.

I mean, it is just extremely time-saving. It’s so efficient! I don’t think it’s an exaggeration or dramatic to say that Dashbird has been a lifesaver for us.

Dashbird provides an easier interface to monitor and debug problems with our Lambdas. Relevant logs are simple to find and view. Dashbird’s support has been good, and they take product suggestions with grace.

Great UI. Easy to navigate through CloudWatch logs. Simple setup.

Dashbird helped us refine the size of our Lambdas, resulting in significantly reduced costs. We have Dashbird alert us in seconds via email when any of our functions behaves abnormally. Their app immediately makes the cause and severity of errors obvious.