On AWS, that question has two answers: API Gateway or an Application Load Balancer. I built with both to see where each one fits.
π₯πΌπππΆπ»π΄
API Gateway: path + HTTP method β integration (GET /items β one Lambda, POST /items β another)
ALB: listener rules, mostly by path (/browse β one target group, /insert β another)
π©π£π
API Gateway: runs on AWS-managed infrastructure. There are no subnets to place it in.
ALB: lives in your VPC, across subnets in at least two Availability Zones.
ππππ΅
API Gateway: API keys, IAM, Cognito, plus Lambda or JWT authorizers for external IdPs
ALB: Cognito or any OIDC-compliant IdP, handled at the listener
ππ²ππ π³πΆπ
API Gateway: REST APIs and microservices that need throttling, caching and usage plans
ALB: web apps, container and EC2 backends, longer-running requests (API Gateway's integration timeout defaults to 29 s)
What surprised me: it isn't either/or. API Gateway can sit in front of a private ALB through a VPC Link.
I'm still learning, but now I choose based on routing and auth needs, not habit.
Which one do you reach for first, and why?
Top comments (0)