What is an API Gateway?
Answer
An API Gateway is a managed service that acts as the front door for backend services, handling HTTP requests from clients and routing them to appropriate backend functions or services. In a serverless context, API Gateway sits in front of Lambda functions, translating HTTP requests into Lambda invocation events. Key features: (1) Request routing — maps HTTP methods and paths to specific Lambda functions; (2) Authentication/Authorization — Lambda Authorizers, JWT validation, IAM permissions, Cognito User Pools; (3) Rate limiting and throttling — protect backends from traffic spikes; (4) Request/response transformation — modify headers, bodies, and status codes; (5) CORS handling — configure cross-origin policies; (6) Caching — cache responses to reduce Lambda invocations and cost; (7) Logging and monitoring — built-in CloudWatch integration. AWS offers HTTP API (cheaper, faster) and REST API (more features) variants of API Gateway.
Previous
What is a serverless framework?
Next
What is the role of environment variables in serverless functions?