← Blog

API Gateway AWS Best Practices for Production

2026-09-08 · 5 min read · SubToAPI Team

Amazon API Gateway is easy to get running in an afternoon and easy to misconfigure in ways that only surface under real traffic — unbounded throttling, missing request validation, authorizers that add 200ms to every call, or a stage with no rollback plan. This article covers the configuration choices that actually matter once you move from a demo to production.

The short version: set explicit throttling limits per usage plan, validate requests at the gateway instead of in your Lambda, cache aggressively for read-heavy endpoints, pick the right authorizer for your latency budget, and instrument everything with CloudWatch and X-Ray before you need it, not after an incident.

Throttling and usage plans

API Gateway applies account-level and stage-level throttling by default, but relying on defaults means one noisy client can degrade the API for everyone else.

aws apigateway create-usage-plan \
  --name "partner-tier-1" \
  --throttle burstLimit=50,rateLimit=20 \
  --quota limit=100000,period=MONTH

Authorization: pick based on latency, not defaults

You have four realistic options, and they have very different cost/latency profiles:

If you're building an authorization layer specifically to front a model API — say, giving each customer their own scoped key for calling Claude — building and operating a custom Lambda authorizer, key rotation, and usage dashboards from scratch is a lot of infrastructure for something that isn't your core product. SubToAPI issues per-application sub_live_... keys with usage metadata and team seats already wired up, so you can skip that layer entirely if the gateway you're building is really just an AI API proxy. See the quickstart for how the keys map to requests.

Request validation before it hits your backend

API Gateway can validate request bodies against a JSON Schema and reject malformed payloads with a 400 before invoking any compute:

{
  "requestValidator": "Validate body",
  "validateRequestBody": true,
  "validateRequestParameters": true
}

This is cheap, fast, and eliminates an entire class of Lambda invocations you're currently paying for just to return a 400. Combine it with models defined per method so the schema lives with the API definition, not scattered across handler code.

Caching for read-heavy endpoints

REST API caching (not available on HTTP APIs) can cut backend load significantly for endpoints that don't change per-request:

Deployment safety: stages, canaries, and rollback

Treat API Gateway deployments with the same discipline as any other production release:

Timeouts and payload limits you can't configure around

Two hard limits catch teams by surprise in production:

If you're proxying to an LLM API specifically, both of these matter more than usual — long completions and streaming responses don't fit cleanly into the 29-second synchronous model, which is one reason a lot of teams end up building or buying a purpose-built proxy rather than wiring API Gateway directly to a model provider. If that's your situation, streaming support and tool-use forwarding are handled for you rather than requiring a custom Lambda-and-WebSocket setup.

Observability: turn it on before you need it

Network exposure

Questions

Should I use HTTP APIs or REST APIs on AWS? HTTP APIs are cheaper and lower-latency but lack request validation, caching, and some authorizer options. Use REST APIs when you need those features; use HTTP APIs for simple proxy integrations where cost matters more.

How do I handle authentication for a public AWS API Gateway? Cognito authorizers cover most standard JWT-based auth with no added compute cost. Reach for a custom Lambda authorizer only when you need logic Cognito can't express, and always enable authorizer caching.

Is API Gateway a good fit for proxying LLM API calls? It can work, but the 29-second timeout and 10MB payload limit conflict with streaming completions, and you'll need to build key management and usage tracking yourself. Tools like SubToAPI handle that layer directly — see pricing if you want to compare the build-vs-buy cost.

Turn your Claude access into an HTTPS API

SubToAPI gives you application API keys, streaming, tool use and usage insights on top of your existing Claude access — set up in minutes.

Start free  Read the quickstart →