Amazon API Gateway là managed service cho phép tạo, publish, bảo vệ và monitor HTTP/WebSocket API ở scale lớn — cổng kết nối giữa client và backend (Lambda, EC2, hoặc bất kỳ HTTP endpoint).
REST API (v1) là loại cũ hơn, hỗ trợ đầy đủ tính năng: request/response transformation, API keys, usage plans, custom authorizers, caching; phù hợp enterprise API cần nhiều tính năng. HTTP API (v2) ra mắt 2019, đơn giản hơn, nhanh hơn (~60% latency thấp hơn), rẻ hơn (~70%) so với REST API; hỗ trợ JWT authorizer, Lambda proxy integration, CORS — phù hợp microservices hiện đại. WebSocket API cho realtime bidirectional communication.
Tích hợp Lambda: chọn Lambda Proxy Integration để API Gateway forward toàn bộ request (headers, body, query params) vào event object của Lambda; response Lambda phải có format {statusCode, headers, body}.
Bảo mật API bằng: Cognito User Pool authorizer, Lambda custom authorizer (kiểm tra JWT/API key tùy chỉnh), hoặc IAM authorization. Throttling mặc định 10,000 RPS per account, có thể tăng qua request. Pricing: HTTP API ~$1/triệu request, REST API ~$3.5/triệu request.