Skip to main content

Amazon API Gateway

Amazon API Gateway is a fully managed service for creating, publishing, and securing APIs at any scale. It acts as the "front door" for applications to access backend services like Lambda, EC2, or any HTTP endpoint.

Types of APIs

TypeUse Case
REST APITraditional RESTful APIs with full feature set
HTTP APILightweight, lower-cost REST APIs
WebSocket APIReal-time, two-way communication

Key Features

  • Authentication: Integration with Cognito, IAM, and custom authorizers
  • Rate limiting: Throttling and quota management
  • Caching: Response caching to reduce backend load
  • Transformations: Request/response mapping templates
  • CORS: Built-in cross-origin resource sharing configuration

Common Patterns

Lambda Integration

The most common pattern pairs API Gateway with Lambda for fully serverless APIs:

Client → API Gateway → Lambda → DynamoDB

Proxy Integration

Pass requests directly to backend services with minimal transformation.

What We Like

  • Zero infrastructure: No servers to manage
  • Automatic scaling: Handles traffic spikes seamlessly
  • Built-in security: WAF integration, throttling, and authentication
  • Observability: CloudWatch metrics and X-Ray tracing

What We Don't Like

  • Cold starts: Combined with Lambda, initial requests can be slow
  • Pricing complexity: Costs can add up with high request volumes
  • 29-second timeout: Hard limit can be problematic for long-running operations

Pricing Consideration

For high-volume APIs, HTTP APIs are significantly cheaper than REST APIs while covering most use cases. We typically recommend HTTP APIs unless you need features exclusive to REST APIs (like request validation or WAF integration).