API Gateway vs ALB vs Lambda Function URLs
Function URLs are the simplest, API Gateway is the most feature-rich, and an ALB fits best alongside containers and servers.
There are three common ways to give a Lambda function (or other backend) an HTTPS address.
Side-by-side
| Lambda Function URL | API Gateway (HTTP API) | Application Load Balancer | |
|---|---|---|---|
| Setup | One setting on the function | An API with routes | Load balancer, listeners, target groups |
| Routes to | One function | Many routes to many backends | Lambda, EC2, containers, IPs |
| Auth | IAM or none | JWT (e.g. Cognito), IAM, Lambda authorizers | OIDC or Cognito sign-in actions |
| Throttling | Only via the function's concurrency | Per route and per stage | No built-in request throttling |
| Custom domain | Via CloudFront | Built in | Built in |
| Pricing | No extra charge | Per million requests | Per hour + capacity units |
| Notable limits | One function per URL | ~30 s integration timeout, 10 MB payloads | 1 MB payloads to Lambda targets |
Choose a Function URL when…
- You have one function that needs a URL: a webhook receiver, a simple internal tool, or a prototype.
- You want response streaming from Lambda.
Choose API Gateway when…
- You're building a real API with multiple routes.
- You need JWT auth, throttling, CORS, stages, or usage plans.
Choose an ALB when…
- You already run containers or EC2 behind an ALB and want to add some Lambda routes to the same domain.
- Traffic is very high and steady, where hourly load balancer pricing can beat per-request pricing.
Tip
Starting a new serverless API? Default to API Gateway HTTP API. Move a route elsewhere only if you hit a specific limit.
Learn more: API Gateway types, Put a URL on your function, and EC2 with a load balancer.
Key takeaways
- Function URLs: simplest, free, one function.
- API Gateway: routing, auth, throttling, CORS, the default for serverless APIs.
- ALB: best when mixing Lambda with containers or servers, or at high steady traffic.