AWS in 1 Min · Episode 133

API Gateway REST vs HTTP vs WebSocket APIs explained

Three API types, three jobs. Watch the one-minute video, then read the details.

David Gomez1:23 video · 3 min read

"Every API Gateway API works the same." It's an easy assumption: you open the console, click "Create API", and get a URL. But Amazon API Gateway offers three different API types: REST APIs, HTTP APIs and WebSocket APIs. They differ in features, price and how they talk to clients, and picking the wrong one means either paying for features you never use or discovering, months later, that the feature you need isn't there.

Request and response, or an open line

REST APIs and HTTP APIs are both RESTful: the client sends one request and gets one response, then the conversation is over. WebSocket APIs work differently: the client opens a persistent connection, and both sides can send messages at any time until it closes.

REST APIs: the full toolbox

REST APIs have the most features. The ones people usually choose them for:

  • API keys and usage plans, with per-client throttling and quotas: essential if you sell or meter access to your API.
  • Caching of responses at the API layer.
  • Request validation and request body transformation before your backend sees anything.
  • AWS WAF integration, private API endpoints inside a VPC, and edge-optimized endpoints.
  • Canary deployments, X-Ray tracing and execution logs.

HTTP APIs: the essentials, cheaper

HTTP APIs were designed with minimal features so they can be offered at a lower price. They still cover what most backends need: JWT authorizers (for example with Amazon Cognito), Lambda authorizers, IAM, CORS, Lambda and HTTP integrations, private integrations to load balancers, custom domains and automatic deployments.

AWS's own guidance is a good rule of thumb: if you don't need a REST-only feature, choose an HTTP API. A common mistake is the opposite: building on HTTP APIs and later needing API keys for partners, or AWS WAF in front of a public endpoint. Check the REST-only list before you commit.

WebSocket APIs: live and two-way

A WebSocket API keeps the connection open, so it suits chats, live dashboards, scoreboards, notifications and multiplayer games. You define routes ($connect, $disconnect, $default and your own), and each client gets a connection ID. Your backend pushes a message to a client by calling the @connections callback URL with that ID, signed with IAM.

Limits worth knowing (they can't be raised): an idle connection closes after 10 minutes, and any connection ends after 2 hours, so clients must reconnect. Messages can be up to 128 KB, sent in frames of 32 KB or less.

Where AI fits

Large language models write their answers token by token. If you wait for the whole answer, users stare at a spinner. With a WebSocket API, a Lambda function can call a model's streaming API (for example Amazon Bedrock's ConverseStream) and post each chunk to the user's connection, so people read while the model writes, and the chat can keep sending messages both ways.

Since November 2025, REST APIs also support response streaming: set the integration's response transfer mode to stream, and API Gateway sends the payload as it is produced, with integration timeouts up to 15 minutes. That is one-way (server to client) and has extra cost; WebSockets remain the choice when the client also needs to send messages mid-stream. HTTP APIs don't support response streaming.

Quick recap

  • REST APIs: most features (API keys, usage plans, caching, validation, WAF, private endpoints).
  • HTTP APIs: the essentials at a lower price; start here unless you need a REST-only feature.
  • WebSocket APIs: persistent two-way connections for live apps and streamed AI answers.
AWS in 1 Min #133 · 1:23

Need an AWS expert on your team?

I'm David, an AWS expert and fractional cloud consultant. I work alongside your team to run your cloud and infrastructure: architecture, security, cost and day-to-day operations. You get senior AWS experience when you need it, without the cost of a full-time hire.

  • Architecture reviews and a clear plan for what to fix first
  • Security hardening: IAM, networking, audits
  • Lower AWS bills without slowing your team down
  • Hands-on help with AI workloads on AWS