AWS
API Gateway

🌐 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.


πŸ’¬ Need a Quick Summary?

Hey! Don't have time to read everything? I get it. 😊
Click below and I'll give you the main points and what matters most on this page.
Takes about 5 seconds β€’ Uses Perplexity AI