Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

API Gateway: Too Many Requests on API creation

See original GitHub issue


When creating an API that contains a lot of endpoints, we reach the API Gateway limit on resource creation and get the error

Too Many Requests (Service: ApiGateway, Status Code: 429, ...

The limits :

Reproduction Steps

Create a REST API with a lot of resources.

What did you expect to happen?

I expected that CDK will consider this and have a ‘sleep’ between calls if necessary.

Right now I’m just commenting some of the nested stack that contains my ressources and unccoment them in batch.

Linked to this I think :

What actually happened?

Got the 429 error


  • CDK CLI Version : 1.109.0 (build c647e38)
  • Node.js Version: v12.18.1

This is 🐛 Bug Report

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:1
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

jweyrichcommented, Sep 18, 2022

Like someone already said, the problem is the rate limit of the API Gateway’s own APIs. The CreateResource is limited to 5 per second per account.

We’re facing the same problem with the Serveless Framework. Nobody solved it properly. AWS premium support suggests introducing DependsOn, but it’s not a definitive solution for sure. The 2nd link below shows AWS published a private resource type Community::CloudFormation::Delay, which also doesn’t feel like a definitive solution alone. We thought of using WaitCondition, but it’s about the same. I believe AWS should be able to handle the throttling between its service calls transparently. The “user” is not making these service-to-service calls. IMHO, since the “user” is providing a valid template that could be fully deployed, if we ignore the rate limit for APIs that the “user” itself is not calling, it should work flawlessly. However, it may become a hard optimization problem to solve.

This issue is related to:

besh0ycommented, Sep 17, 2022

Hello @peterwoodworth @nija-at I’ve been struggling with this issue for quite some time and I’d like to re-open it.

I’ve created this: repository, that consistently replicates the issue, please feel free to check it out.

The code creates a REST API with a large number of endpoints and methods, all created in multiple nested stacks. Deployment of those stacks always fails, returning a too many requests error, also rollback fails for the same reason.

I could temporarily avoid this problem by decreasing the number of resources in each nested stack and making them depend on each other during deployment so they don’t get deployed in parallel, but it’s much slower and inefficient.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Throttle API requests for better throughput - AWS Documentation
When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many...
Read more >
AWS API Gateway: Error 429 Too many requests
UPDATE: I've just created a POST method on the same resource, with the same parameters and the same lambda. It is working. I...
Read more >
Fix the Most Common API Gateway Request Errors - Dashbird
Handling API Gateway 429 Error: Too Many Requests ... The second 429 error is of temporary nature. You would get it if you...
Read more >
Throttling requests to your HTTP API - Amazon API Gateway
When request submissions exceed the steady-state request rate and burst limits, API Gateway begins to throttle requests. Clients may receive 429 Too Many...
Read more >
429 - Too Many Requests | AWS re:Post
There was a usage plan in place for this API. (in API gateway, under Usage Plans). For my API there was a quota...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found