Amazon API Gateway (REST vs HTTP APIs)
Part of the AWS Roadmap
In short
Your Lambda function needs a URL that mobile apps and websites can call safely. API Gateway gives you that front door, along with auth, throttling and custom domains.
API Gateway exposes HTTP endpoints that route to Lambda or other backends. HTTP APIs are simpler and cheaper for most Lambda-backed APIs, while REST APIs offer more features such as API keys with usage plans and request validation. WebSocket APIs support two-way connections.

Think of it like this
The hotel reception
Guests at a Goa hotel never walk into the kitchen. They ask reception, which checks their room key, notes the request, and sends it to housekeeping or the kitchen. A small guesthouse reception does just that, quickly and cheaply. A five-star reception also handles VIP passes, quotas and fancy rules. HTTP APIs are the guesthouse, REST APIs are the five-star desk.
Watch it happen
HTTP API vs REST API
HTTP API
- Lower cost and lower latency
- Built-in JWT authorizers (Cognito, any OIDC)
- Simple CORS and auto-deploy stages
- Great default for Lambda backends
REST API
- API keys with usage plans and quotas
- Request validation and transformations
- Response caching and AWS WAF integration
- Private APIs reachable only inside a VPC
Start with an HTTP API. Choose a REST API when you need usage plans for API customers, request validation, caching, WAF directly on the API or private endpoints.
The big ideas
What you need to know
Routes and integrations
A route such as GET /orders/{id} connects to an integration, usually a Lambda function or an HTTP backend.
Authorizers
JWT authorizers validate tokens from Cognito or another identity provider. Lambda authorizers run your own checks.
Throttling
Account and route-level limits protect your backend. Callers over the limit get 429 Too Many Requests.
Custom domains
Map api.priyabakes.in to your API with an ACM certificate in the same Region as the API.
See it in code
Walk through the code
1# Quick create: an HTTP API that sends every route to one Lambda2aws apigatewayv2 create-api \3 --name orders-api \4 --protocol-type HTTP \5 --target arn:aws:lambda:ap-south-1:111122223333:function:orders-handler6 7# Allow API Gateway to invoke the function8aws lambda add-permission \9 --function-name orders-handler \10 --statement-id apigw-invoke \11 --action lambda:InvokeFunction \12 --principal apigateway.amazonaws.com \13 --source-arn "arn:aws:execute-api:ap-south-1:111122223333:a1b2c3d4e5/*"1/3Quick create makes the API, a default route, a Lambda proxy integration and an auto-deploying stage.
AWS CLI v2. apigatewayv2 manages HTTP and WebSocket APIs. REST APIs use the older apigateway command group.
Save yourself the pain
Common mistakes
Oops
Choosing a REST API by default because 'REST' sounds like what you're building.
Do this instead
Both types serve RESTful endpoints. The names are product names. Start with HTTP API unless you need a REST-only feature.
Oops
Doing token checks by hand inside every Lambda function.
Do this instead
Attach a JWT authorizer to the routes so invalid tokens are rejected before your code runs.
Your mission
Ship a tiny API
Quick check
A partner needs an API key with a daily quota of 10,000 calls. Which API type do you need?
Go deeper
- 1Create an HTTP API with a GET route that calls a Lambda function.
- 2Read the AWS comparison page for REST and HTTP APIs and list three differences.
- 3Enable CORS so a frontend on another domain can call your API.
More topics at this stop
Stuck on this topic? Ask an Insider
Get 1:1 guidance from people who've walked this exact path — on the InsideEdge app.