AWS API Gateway Throttling: How to Protect APIs from Traffic Spikes and Abuse
Your API works perfectly in development.
Then production traffic arrives.
A customer accidentally sends thousands of requests.
A mobile app gets stuck in a retry loop.
A marketing campaign suddenly drives 10× normal traffic.
Or worse, someone starts abusing a public endpoint.
Your backend doesn’t necessarily fail because the application is badly designed.
Sometimes, it fails because too many requests arrive at the same time.
This is where rate limiting and throttling become important.
With Amazon API Gateway, you can control how much traffic your APIs accept and prevent a sudden traffic spike from overwhelming downstream services.
But there’s an important distinction:
Throttling isn’t just about rejecting requests. It’s about controlling how traffic flows through your system.
Let’s understand how to design it properly.
What Is Rate Limiting?
Rate limiting answers a simple question:
How many requests should a client be allowed to make within a given period?
For example:
Client
|
| 100 requests/minute
v
API Gateway
|
+----> Requests within limit → Backend
|
+----> Requests above limit → ThrottledSuppose an API allows:
100 requests/secondA client sending:
80 requests/secondis fine.
A client suddenly sending:
500 requests/secondmay exceed the configured limit.
The gateway can throttle some of those requests rather than forwarding all of them to the backend.
Why Do APIs Need Throttling?
Without throttling, traffic can propagate through your entire architecture.
Imagine:
Internet
|
v
API Gateway
|
v
Lambda
|
v
DynamoDBNow imagine 10,000 requests suddenly arrive.
Those requests don’t stop at API Gateway.
They can create pressure on:
- Lambda concurrency
- Database capacity
- Downstream APIs
- Connection pools
- CPU
- Memory
- Network bandwidth
- Third-party services
The failure can cascade.
Traffic Spike
|
v
API Gateway
|
v
Lambda concurrency ↑
|
v
Database pressure ↑
|
v
Latency ↑
|
v
Timeouts ↑
|
v
Retries ↑
|
v
Even more trafficThis is a classic feedback loop.
Throttling helps break it.
Throttling vs Rate Limiting
These terms are often used interchangeably, but there’s a useful distinction.
Rate limiting
Defines how much traffic is allowed.
For example:
100 requests/secondThrottling
Controls what happens when traffic exceeds the allowed rate.
For example:
Allowed → Process request
Exceeded → Delay / reject / throttle requestIn API Gateway discussions, you’ll commonly see both concepts together.
The important thing is understanding the behavior you’re designing.
API Gateway’s Throttling Model
API Gateway uses a token bucket-style throttling mechanism.
You don’t need to memorize the implementation details to use it effectively.
The useful mental model is:
Tokens
|
v
+---------------+
Requests → Token Bucket |
+---------------+
|
+------+------+
| |
Allowed Limited
| |
v v
Backend ThrottledThe bucket has two important concepts:
- Rate — how quickly requests can be accepted over time.
- Burst — how many requests can temporarily arrive above the steady-state rate.
This distinction is extremely important.
Rate vs Burst
Suppose you configure:
Rate = 100 requests/second
Burst = 200 requestsThink of it like:
Steady traffic
|
v
100 req/sec
|
+------+
|
v
Burst capacityThe rate controls the sustained traffic level.
The burst provides temporary capacity for short spikes.
This matters because real applications rarely generate perfectly smooth traffic.
For example:
Second 1 → 60 requests
Second 2 → 80 requests
Second 3 → 180 requests
Second 4 → 70 requestsA system that only considers the average rate may look fine.
But the sudden spike still matters.
That’s why rate and burst should be considered together.
Example: E-Commerce API
Imagine an e-commerce API.
You have:
GET /products
POST /orders
GET /orders/{id}
POST /paymentsNot all endpoints should necessarily have the same traffic policy.
For example:
GET /productsmight receive thousands of requests.
While:
POST /paymentsmay need much tighter controls.
Why?
Because the cost and risk of the operations are different.
A product lookup might simply read cached data.
A payment operation could:
- Invoke multiple services
- Write to databases
- Call an external payment provider
- Trigger notifications
- Create financial side effects
So a blanket:
100 requests/sec for everythingmay not be a good design.
Think About Traffic by API, Stage, and Method
One of the important design decisions with API Gateway is where you apply throttling.
You may want a broad default policy:
API
|
+--> Default throttlingAnd then more restrictive controls for particular operations.
Conceptually:
API
|
+--> GET /products → Higher limit
|
+--> GET /orders → Medium limit
|
+--> POST /payments → Lower limitThe exact configuration depends on the API Gateway API type and features you’re using, but the architectural principle is universal:
Throttle based on the cost and importance of the operation, not just the number of endpoints.
Global Throttling
Suppose your API has:
GET /products
GET /orders
POST /orders
POST /paymentsYou might establish a broad traffic ceiling.
For example:
API
|
| 1,000 req/sec
v
API Gateway
|
+--> Products
+--> Orders
+--> PaymentsThis creates a coarse safety boundary.
It’s useful as a first line of defense.
But it doesn’t distinguish between cheap and expensive operations.
That’s why global throttling alone is often insufficient for larger systems.
Per-Client Throttling
Now imagine your API has multiple customers.
Customer A
Customer B
Customer C
Customer D
|
v
API GatewayYou don’t necessarily want one customer consuming all available capacity.
A better model could be:
Customer A → 100 req/sec
Customer B → 100 req/sec
Customer C → 500 req/secThis becomes particularly useful for SaaS platforms and public APIs.
Different customers can have different capacity requirements.
For example:
Free Plan
|
+--> 10 req/sec
Pro Plan
|
+--> 100 req/sec
Enterprise
|
+--> Custom limitThis is where API management features such as API keys and usage plans can become relevant for REST APIs.
But Don’t Treat API Keys as Authentication
This is worth repeating.
An API key can help identify and control API consumers.
But:
An API key is not a substitute for strong authentication.
You might have:
Authentication
|
v
Cognito / IAM / Identity Provider
|
v
Traffic control
|
v
API Gateway throttlingThese solve different problems.
Authentication answers:
Who is calling?
Throttling answers:
How much traffic should they be allowed to generate?
Protecting Backend Capacity
One of the biggest benefits of throttling is protecting downstream systems.
Imagine:
API Gateway
|
1,000 req/sec
|
v
Lambda
|
500 concurrent
|
v
DatabaseSuppose your database can comfortably handle only a fraction of that workload.
You don’t want API Gateway to blindly forward everything.
Instead:
Internet
|
v
API Gateway
|
| Controlled traffic
v
Lambda
|
v
DatabaseThe gateway becomes an early protection layer.
Throttling Is Not Capacity Planning
Here’s an important distinction.
Suppose your backend can process:
500 requests/secYou configure:
API Gateway → 500 req/secThat doesn’t magically guarantee your system can safely process 500 requests/sec.
Your request cost may vary.
For example:
GET /healthcould be extremely cheap.
While:
POST /checkoutcould trigger five downstream calls.
So:
500 requests/secdoesn’t necessarily mean:
500 identical units of work/secThis is why throttling must be designed alongside capacity planning.
Throttling and Lambda
Lambda introduces another important consideration: concurrency.
Imagine:
API Gateway
|
| 5,000 req/sec
v
Lambda
|
+--> Concurrency increases
|
v
DatabaseIf your Lambda functions invoke databases or third-party APIs, unlimited concurrency can become dangerous.
A more controlled architecture is:
API Gateway
|
| Throttle
v
Lambda
|
| Controlled concurrency
v
DatabaseYou can use throttling together with Lambda concurrency controls to create multiple protection layers.
Throttling and Retries: The Dangerous Combination
One of the most common mistakes is implementing throttling without thinking about retries.
Suppose the API returns:
429 Too Many RequestsThe client thinks:
Get TheVega.AI’s stories in your inbox
Join Medium for free to get updates from this writer.
“I’ll try again immediately.”
Then:
Request
|
v
API Gateway
|
X 429
|
v
Client
|
| Immediate retry
v
API Gateway
|
X 429
|
v
ClientNow multiply this across thousands of clients.
You can create a retry storm.
Use Exponential Backoff
Clients should generally respect throttling responses and retry intelligently where retries are appropriate.
A common strategy is exponential backoff:
Attempt 1 → wait 100 ms
Attempt 2 → wait 200 ms
Attempt 3 → wait 400 ms
Attempt 4 → wait 800 msOften, some form of jitter is added so that many clients don’t retry at exactly the same time.
Conceptually:
429
|
+--> Wait
|
+--> Randomized delay
|
+--> RetryThis helps turn synchronized retries into distributed retries.
Not Every Request Should Be Retried
This is another important point.
A GET request may be safe to retry in many situations.
A payment operation may require much more careful handling.
For example:
POST /paymentsIf the client doesn’t know whether the request reached the backend, blindly retrying could potentially create duplicate business operations.
For critical operations, use patterns such as idempotency keys where appropriate.
For example:
POST /payments
Idempotency-Key: 8f92a1...The backend can use the key to ensure that the same logical operation isn’t processed multiple times.
Throttling and idempotency solve different problems, but they often need to work together.
Protect Expensive APIs Differently
Consider these endpoints:
GET /products
GET /recommendations
POST /checkout
POST /reports/generateThey have very different resource costs.
A better design might conceptually look like:
Cheap read
|
+--> Higher rate
Normal operation
|
+--> Medium rate
Expensive operation
|
+--> Lower rateFor example, generating a large report may trigger:
API Gateway
|
v
Lambda
|
+--> Database
+--> S3
+--> Analytics
+--> NotificationAllowing unlimited report generation just because the API can technically handle the HTTP requests is a bad idea.
Sometimes the right answer isn’t a higher throttle limit.
It’s an asynchronous architecture.
Client
|
v
API Gateway
|
v
Submit Job
|
v
Queue
|
v
WorkerNow the API remains responsive while expensive work is processed at a controlled rate.
Throttling vs Queuing
This distinction is extremely useful.
Throttling
Says:
“You can’t send more traffic than this right now.”
Too much traffic
|
v
Throttle
|
XQueuing
Says:
“I can’t process this immediately, but I’ll process it later.”
Too much work
|
v
Queue
|
v
WorkerFor synchronous APIs, throttling is often appropriate.
For long-running or expensive operations, queues can be a better design.
A Production Architecture
Let’s combine the ideas.
Internet
|
v
API Gateway
|
+--------------+--------------+
| | |
AuthN Throttling Logging
| | |
+--------------+--------------+
|
v
Backend
|
+-------------+-------------+
| |
Lambda Services
| |
+-------------+-------------+
|
v
DatabaseFor asynchronous workloads:
Client
|
v
API Gateway
|
| Throttle
v
Lambda
|
v
SQS
|
v
Workers
|
v
Database / External APIsThis architecture gives you much more control over traffic.
What Happens When the Limit Is Exceeded?
When API Gateway throttles a request, clients commonly receive:
429 Too Many RequestsThe important lesson is:
A 429 isn’t necessarily an application failure.
It can be a deliberate protection mechanism.
Your monitoring should distinguish between:
5xx → Backend/system failure
4xx → Client/request issue
429 → Traffic exceeded configured capacityThat distinction makes operational debugging much easier.
Monitoring Throttling
You shouldn’t configure throttling and then forget about it.
Watch metrics such as:
- Request count
- Latency
- 4xx responses
- 5xx responses
- Throttled requests
- Backend integration errors
A useful operational pattern is:
Traffic
|
v
Requests ↑
|
v
429s ↑
|
v
InvestigateIf you consistently see throttling during normal business traffic, your limit may simply be too low.
If throttling suddenly appears during an unexpected spike, it may be doing exactly what you designed it to do.
Common Mistakes
Mistake 1: Setting the highest possible limit
More traffic isn’t always better.
A higher gateway limit can simply move the bottleneck downstream.
Always ask:
What can my backend safely process?
Mistake 2: Using one limit for every endpoint
Not every API operation costs the same.
Protect expensive operations more aggressively.
Mistake 3: Ignoring burst traffic
An API may be fine at a sustained rate but struggle with sudden spikes.
Think about both:
Steady-state rate
+
Burst capacityMistake 4: Ignoring client retries
A throttled client that retries immediately can turn a traffic spike into a retry storm.
Design clients with exponential backoff and jitter.
Mistake 5: Using throttling as your only protection
Throttling is one layer.
You may also need:
- WAF protections
- Authentication
- Authorization
- Lambda concurrency controls
- Database capacity controls
- Queues
- Caching
- Circuit breakers
- Application-level quotas
Mistake 6: Confusing throttling with DDoS protection
Throttling helps control application traffic, but it isn’t a complete DDoS defense strategy.
For internet-facing APIs, consider the broader AWS security architecture, including services such as AWS WAF and AWS Shield where appropriate.
How Should You Choose Your Limits?
Don’t start with:
“What number should I put into API Gateway?”
Start with:
“How much work can my system safely handle?”
Then work backward.
For example:
Database safe capacity
↓
Backend safe concurrency
↓
Application throughput
↓
API traffic limit
↓
Client quotasSuppose testing shows:
Backend safe capacity = 300 req/secYou might not immediately configure:
API Gateway = 300 req/secYou may want some safety margin.
The exact value should come from load testing, traffic patterns, downstream limits, and business requirements.
Don’t guess your production limits. Measure them.
A Practical Throttling Checklist
Before launching an API, ask:
Traffic
- What’s the expected average traffic?
- What’s the expected peak?
- How large can a sudden burst be?
Backend
- What’s the safe backend throughput?
- What’s the Lambda concurrency limit?
- What can the database handle?
- Are there third-party API limits?
API Gateway
- Is there a sensible default throttle?
- Do expensive endpoints need tighter controls?
- Do different customers need different quotas?
Clients
- Do clients understand
429responses? - Do they use exponential backoff?
- Do they use jitter?
- Are critical operations idempotent?
Architecture
- Should this operation be asynchronous?
- Can caching reduce repeated requests?
- Would a queue protect a downstream system?
Monitoring
- Are throttled requests visible?
- Can you distinguish expected throttling from an incident?
- Are alerts based on meaningful thresholds?
The Bigger Lesson
Rate limiting isn’t really about putting a number like:
100 requests/secinto API Gateway.
It’s about protecting the entire system behind the API.
Think about the complete chain:
Client
|
v
API Gateway
|
v
Lambda / ECS
|
v
Database
|
v
External ServicesEvery layer has a capacity limit.
Your API gateway should help ensure that traffic entering the system doesn’t overwhelm the weakest component.
And when traffic exceeds capacity, you have choices:
Traffic spike
|
+--> Throttle
|
+--> Queue
|
+--> Cache
|
+--> Scale
|
+--> RejectGood architecture isn’t about accepting every request.
It’s about accepting the right amount of work safely.
Final Takeaway
API Gateway throttling is a relatively small configuration feature with a much bigger architectural purpose.
It can help you:
- Protect backend capacity
- Control traffic spikes
- Prevent noisy neighbors
- Manage customer usage
- Reduce cascading failures
- Make overload behavior predictable
But effective throttling requires more than setting a rate.
You need to consider:
Rate
+
Burst
+
Backend Capacity
+
Client Retries
+
Quotas
+
Monitoring
+
Async ProcessingThe goal isn’t:
“How many requests can my API accept?”
The better question is:
“How much work can my entire system safely process?”
Once you answer that, your API Gateway throttling strategy becomes much easier to design.
How Are You Handling API Traffic Spikes?
Have you used API Gateway throttling in production?
Did you solve overload using throttling, caching, queues, autoscaling, or a combination of them?
Share your approach in the comments. Real-world traffic patterns often teach us more than architecture diagrams ever can.
And if this article helped you understand API throttling a little better, share it with another engineer designing a production API.









