Amazon API Gateway
The front door of your API: it receives requests and passes them to your code.
Amazon API Gateway gives your API a public address on the internet and takes care of everything that happens before your code runs. You define routes like GET /orders or POST /users, tell it where each one goes (usually an AWS Lambda function, sometimes a server or another AWS service), and it handles the rest.
'The rest' is a lot: serving over HTTPS, checking API keys or login tokens (it works directly with Amazon Cognito), limiting how many requests per second each client can make, caching responses, logging every call to Amazon CloudWatch, and even keeping WebSocket connections open and turning their messages into events for your code.
Example: a mobile app calls https://api.example.com/orders. API Gateway receives the request, verifies the user's token, rejects it if that client already exceeded its quota, and otherwise invokes a Lambda function with the request body. The function returns JSON, and the gateway sends it back to the phone. No server was ever provisioned.
Together with Lambda and Amazon DynamoDB it is the classic recipe for a serverless backend: you pay per request, and it scales from zero to millions of calls without touching anything.
Keep in mind
- You define routes and point each one at Lambda, a server or an AWS service.
- Authentication, rate limiting, caching and logging happen before your code runs.
- Two flavors: HTTP APIs (simpler and cheaper) and REST APIs (more features).
- Billed per million requests; nothing to run or pay for while idle.