Skip to content

Instantly share code, notes, and snippets.

@AgilanVageesan
Created March 18, 2025 16:28
Show Gist options
  • Select an option

  • Save AgilanVageesan/ad77d77a0090428f35cf7a739f50d4e5 to your computer and use it in GitHub Desktop.

Select an option

Save AgilanVageesan/ad77d77a0090428f35cf7a739f50d4e5 to your computer and use it in GitHub Desktop.

πŸ“Š AWS API Gateway: Key Limits, Features & Best Practices

πŸ”Ή API Gateway Limitations & Maximum Values

Feature Limit Notes
Max Request Payload Size 10 MB Larger payloads require direct integrations (e.g., S3 Pre-Signed URLs).
Max Response Payload Size 10 MB Consider compression techniques to optimize responses.
Max Concurrent Requests 10,000 per region Requests beyond this require throttling or API throttling policies.
Max API Stages per Gateway 10 Use separate API Gateways if more stages are needed.
Max Routes per API (HTTP/WebSocket) 300 Applies to HTTP and WebSocket APIs, not REST APIs.
Max Cache TTL 3600 seconds (1 hour) Lower TTL values increase backend load but ensure fresher data.
Max API Keys per Account 10,000 Use Cognito or Lambda Authorizers for large-scale authentication needs.
Max Integration Timeout 29 seconds Long-running operations should be handled asynchronously.
Max Custom Domain Names 60 per account Consider using API Gateway mappings for better domain organization.
Max Deployment History per Stage 10 Older deployments are deleted automatically. Use backups if needed.
Max WebSocket Connection Lifetime Unlimited (client-side controlled) Connections rely on client heartbeat messages.

πŸ”Ή API Gateway Feature Comparison

Feature REST API HTTP API WebSocket API Best Use Case
Use Case Traditional RESTful services Lower-cost REST API alternative Real-time bidirectional communication Microservices, IoT, Chat apps
Latency Slightly higher Lower Low Faster response times required
AWS Service Integration Full support Limited Limited Serverless & AWS-native services
Streaming Support No No Yes Data streaming and real-time updates
Authentication IAM, Cognito, Lambda IAM, JWT IAM, JWT Secure API access control
Caching Support Yes No No Optimizing performance and cost
WebSockets No No Yes Live chat, notifications, and gaming APIs
Cost Efficiency Higher Lower Based on connection time Budget-conscious API deployment
Supports Private APIs Yes Yes No Internal API access within VPC
Rate Limiting & Throttling Yes Yes Yes Managing high-traffic APIs

πŸ› οΈ Best Practices for API Gateway Optimization

πŸ”Ή Use CloudFront with API Gateway – Distribute API traffic globally and reduce latency.
πŸ”Ή Enable Caching – Reduce backend load and improve response times.
πŸ”Ή Leverage Lambda Authorizers – Secure APIs without maintaining API keys.
πŸ”Ή Optimize WebSocket API Costs – Close inactive connections and use DynamoDB for state management.
πŸ”Ή Monitor API Performance with CloudWatch & X-Ray – Debug bottlenecks and optimize API responses.

πŸ’‘ API Gateway helps optimize API performance, scalability, and security. Understanding these limits ensures effective API design! πŸš€

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment