API Gateway Throttling and Rate Limits
What you'll learn: How to configure usage plans, throttling limits, and burst capacity to protect your backend services from being overwhelmed by sudden traffic spikes.
What Are Throttling and Rate Limits?
Think of an API Gateway as a bouncer at a popular nightclub. Without limits, everyone rushes in at once, overcrowding the venue and creating chaos. Throttling and rate limits control how many requests can enter over time, keeping your backend services safe and responsive.
Throttling restricts the number of requests per second (RPS) your API can handle, while rate limits cap total requests over a longer period (like requests per day or month).
Core Components
Usage Plans
Usage plans bundle throttling settings with API keys to enforce different limits for different customer tiers. For example:
- Free tier: 100 requests/second, 10,000 requests/day
- Premium tier: 1,000 requests/second, 1,000,000 requests/day
Throttling Limits
- Steady-state rate: Maximum sustained requests per second
- Account-level limits: Apply across all APIs in your account
- API/stage-level limits: Apply to specific deployments
- Method-level limits: Fine-grained control per endpoint
Burst Capacity
This is your "overflow bucket" that handles temporary traffic spikes above the steady-state rate. If your steady-state is 1,000 RPS but burst capacity is 2,000, you can handle short surges without rejecting requests immediately.
How It Works
When requests exceed limits, the API Gateway returns 429 Too Many Requests HTTP status codes. Clients should implement exponential backoff and retry logic to handle these responses gracefully.
Key Takeaway: Throttling and rate limits protect your backend infrastructure by controlling request flow through usage plans, steady-state limits, and burst capacity—preventing overload while maintaining service quality for legitimate users.