"Your backend can face the internet on its own." It can, but then every caller reaches your code directly: nothing checks who they are, nothing limits how fast they call, and nothing stands between a traffic spike and your servers. Amazon API Gateway is a managed front door that sits in front of your backend and handles those jobs for you.
What API Gateway does
API Gateway receives HTTPS requests at a stable endpoint and routes each one to a backend: a Lambda function, containers behind a load balancer (also inside a private VPC through a VPC link), another AWS service, or any HTTP endpoint. It comes in three flavours, REST APIs, HTTP APIs and WebSocket APIs, with different features and prices; the next episode compares them.
Authorizers: who is calling?
Before a request reaches your code, API Gateway can authenticate and authorize it:
- IAM authorization, for callers with AWS credentials (other services, internal tools).
- Amazon Cognito user pools (REST) or JWT authorizers (HTTP APIs), which check tokens from your sign-in provider.
- Lambda authorizers, your own function that inspects a token or header and returns allow or deny.
Rejected requests never reach the backend, so you don't pay for its compute or expose it to unauthenticated traffic.
Throttling and 429s
API Gateway throttles with a token bucket. By default an account gets 10,000 requests per second per Region across its APIs, with a burst bucket of 5,000 requests (some newer Regions start at 2,500 per second). The quota can be raised on request. You can set lower limits per stage or per method. Requests beyond the limits get 429 Too Many Requests, and well-behaved clients retry with backoff.
Usage plans and API keys
For REST APIs, usage plans turn your API into a product: each client gets an API key, a rate limit and a quota per day, week or month. The common mistake is treating that API key as a password. AWS is explicit: don't use API keys for authentication or authorization. A key identifies a client for metering and throttling; protect the API with IAM, Cognito or a Lambda authorizer.
Where AI fits
If you sell or share access to a model, API Gateway is the natural front door and rate limiter for that AI API. Authorizers decide who may call it, and a usage plan per customer caps how many requests each one makes, so one heavy user can't flood the model or starve everyone else. Keep in mind that AWS calls usage plan throttles and quotas best effort and says not to rely on them to control costs: pair them with AWS Budgets alerts and, for abuse, AWS WAF. Since November 2025, REST APIs can also stream responses, so a model's answer can reach the client as it is generated, with integration timeouts up to 15 minutes.
Quick recap
- One front door: API Gateway routes requests to Lambda, containers or any HTTP backend.
- Authorizers check identity before your code runs; an API key is not a password.
- Throttles and usage plans protect the backend, and a budget alarm protects the bill.