π AWS API Gateway β Complete DevOps Interview Deep Dive
β Part 1 β What API Gateway Actually Is (Real View)
β Q1 β What is API Gateway in practical production terms?
API Gateway is a managed API front-door service that handles request routing, authentication, throttling, validation, and integration with backends like Lambda, ECS, EKS, or HTTP services. It removes the need to manage API servers or reverse proxies. It is commonly used as the public entry layer for serverless and microservice APIs.
β Q2 β Real production use cases of API Gateway
Real-world uses:
- Public REST APIs for web/mobile apps
- Lambda-backed microservice APIs
- Fintech partner integration endpoints
- Webhook receivers
- Internal service APIs with IAM auth
- Rate-limited partner APIs
- API facade in front of legacy systems
- Edge auth + routing layer
In fintech β very common for partner + merchant APIs with auth + throttling.
β Part 2 β Types of API Gateway (Interview Must-Know)
β Q3 β Types of API Gateway and when to use each?
There are three main types:
REST API (classic) β most features, mapping templates, fine control, higher cost. HTTP API β cheaper, faster, simpler, fewer features β best for modern APIs. WebSocket API β persistent bidirectional connections.
Interview rule: If you donβt need advanced transforms β choose HTTP API.
β Q4 β REST vs HTTP API β real tradeoff?
REST API has:
- request/response mapping templates
- API keys & usage plans
- more auth options
- more mature features
- higher latency & cost
HTTP API has:
- lower cost
- lower latency
- simpler config
- limited transformations
Modern greenfield β HTTP API first.
β Part 3 β Integration Power (Where It Connects)
β Q5 β What backends can API Gateway integrate with?
- Lambda (most common)
- HTTP services
- ECS/EKS services
- ALB/NLB endpoints
- Step Functions
- AWS service integrations (SQS, EventBridge, etc.)
It can be both synchronous and async trigger layer.
β Q6 β Direct service integration β why powerful?
API Gateway can call AWS services directly without Lambda. Example: put message to SQS or start Step Function. This removes compute layer and reduces cost + latency. Very strong pattern for async APIs.
β Part 4 β Security & Auth Design
β Q7 β Auth options in API Gateway
Multiple options:
- IAM auth (SigV4)
- Cognito JWT
- Lambda authorizer
- Custom JWT
- API keys (not auth β just metering)
- mTLS (REST API)
Fintech pattern β JWT + Lambda authorizer or Cognito.
β Q8 β Lambda authorizer β when used?
Used when auth logic is custom β like fintech token validation, DB lookup, partner key validation. It runs before backend call and returns policy. Adds latency β must be cached.
β Part 5 β Rate Limiting & Throttling
β Q9 β How throttling works in API Gateway?
Two levels:
- account-level limits
- per-stage or per-route limits
Uses token bucket model. Exceed β 429 errors. Protects backend from overload.
β Q10 β Usage plans β what are they really for?
Usage plans attach API keys to rate + quota limits. Used for partner/merchant APIs. Not security β traffic control + billing control.
β Part 6 β Limits & Quotas (Interview Favorites)
β Q11 β Important API Gateway limits
Key limits:
- payload size limits
- integration timeout limits
- request rate limits
- header size limits
- mapping template size limits
- WebSocket connection limits
Interviewers expect you to mention timeout + payload + throttling.
β Q12 β Integration timeout β why matters?
If backend takes too long, API Gateway returns error even if backend later succeeds. Important for Lambda or slow services. Must align backend timeout with gateway limit.
β Part 7 β Performance Behavior
β Q13 β API Gateway latency sources
Latency includes:
- TLS termination
- auth processing
- mapping templates
- integration call
- Lambda cold start (if Lambda backend)
HTTP API generally lower latency than REST API.
β Q14 β Caching in API Gateway β when useful?
REST API supports response caching. Good for read-heavy endpoints. Reduces backend load and cost. Must handle cache invalidation carefully.
β Part 8 β Cost Tradeoffs
β Q15 β When API Gateway is cost-effective?
Cost-effective for:
- moderate traffic
- serverless APIs
- partner APIs needing throttling
- event-driven integrations
β Q16 β When it becomes expensive?
Very high request volume APIs. High payload APIs. Streaming APIs. In such cases ALB + service may be cheaper.
β Part 9 β Design Patterns
β Q17 β API Gateway + Lambda β best practices
- keep Lambda small & fast
- idempotent handlers
- structured error responses
- input validation at gateway
- timeout alignment
- provisioned concurrency if needed
β Q18 β API Gateway in microservices architecture β role?
Acts as edge gateway or BFF layer. Centralizes auth, throttling, logging. Routes to multiple backend services. Reduces duplication inside services.
β Part 10 β When NOT to Use API Gateway
β Q19 β When should you avoid API Gateway?
Avoid when:
- ultra-high throughput APIs
- large streaming payloads
- WebSocket scale beyond limits
- internal-only traffic (use mesh/ingress)
- long-lived connections
β Q20 β Common real-world mistake with API Gateway
Using it for internal service-to-service calls. That adds cost and latency. Itβs edge gateway β not east-west router.