# ALB vs API Gateway

AWS comparisons · Updated 17 November 2026

**Short answer:** Choose API Gateway when you need API management: per-client API keys and usage plans, request validation, JWT or Lambda authorisers, caching, or a pay-per-request bill for low or spiky traffic. Choose an Application Load Balancer for steady, high-volume HTTP traffic to containers or instances, long-running requests, WebSockets to servers, or when per-request API Gateway charges would dominate the bill.

## ALB vs API Gateway compared

| Factor | Application Load Balancer | API Gateway (REST or HTTP API) |
|---|---|---|
| Pricing model | Per hour plus LCUs; you pay while it exists | Per million requests plus data out; nothing when idle |
| Request timeout | Configurable idle timeout; suits long requests | Integration timeout up to 29 s (REST, raisable for Regional and private APIs) or 30 s (HTTP API) |
| Payload size | No small fixed cap for instance or IP targets; 1 MB for Lambda targets | 10 MB |
| Targets | EC2, IPs, containers, Lambda | Lambda, HTTP endpoints, AWS services, private ALB/NLB via VPC link |
| Auth | OIDC or Cognito user sign-in at the listener | IAM, Cognito, JWT (HTTP API), Lambda authorisers |
| Per-client limits | No | Usage plans and API keys (REST APIs) |
| Throttling | None built in | Account-level 10,000 RPS by default in most Regions, plus per-route or per-stage limits |
| WAF | Yes | REST APIs only |

## When API Gateway is the better front door

- Public APIs consumed by third parties who need keys, quotas and throttling per customer.
- Serverless backends on Lambda with modest or unpredictable traffic, where an always-on ALB would cost more than the requests.
- You want request validation, request and response mapping, mock integrations or caching without writing code (REST APIs).
- Direct AWS service integrations, such as putting a message on SQS or starting a Step Functions execution without a Lambda in between.

## When an ALB is the better front door

- High, steady request volumes. Per-request pricing grows linearly with traffic; LCU pricing grows with load more gently.
- Requests that run longer than about 30 seconds, uploads larger than 10 MB, or streaming to servers.
- Container and instance backends already in a VPC, with path and host routing across many services.
- You already handle auth and rate limiting in the application or a service mesh.

## Using both

A common layout puts API Gateway in front for authentication, keys and throttling, then a VPC link to a private ALB or NLB that spreads traffic across ECS services. You pay for both, so use it only when you need API Gateway's management features and the ALB's routing. Another option: CloudFront in front of either, for caching and WAF at the edge.

If you compare costs, model API Gateway as monthly requests × the per-million rate for your API type, and the ALB as hours plus LCUs based on new connections, active connections, processed bytes and rule evaluations, using the current pricing pages.

## Common wrong reasons

- **"API Gateway is required for Lambda."** ALBs can invoke Lambda directly, as can Lambda function URLs.
- **"ALB cannot authenticate users."** It can, with OIDC providers or Cognito on HTTPS listeners; what it lacks is API keys and per-client quotas.
- **"API Gateway scales without limits."** It has a Regional account throttle and fixed integration timeouts; plan for both.

## Questions

### Is ALB cheaper than API Gateway?

At low or spiky volumes API Gateway is often cheaper because you pay only per request. At high steady volumes an ALB usually costs less because its charge is per hour and capacity unit, not per request.

### Can an ALB replace API Gateway for Lambda?

Yes for simple HTTP to Lambda routing, within the ALB 1 MB request and response limits for Lambda targets. You lose API keys, usage plans, request validation and caching.

### What is the API Gateway timeout?

REST API integrations allow 50 ms to 29 seconds by default, raisable for Regional and private APIs at the cost of throttle quota. HTTP API integrations allow up to 30 seconds.

## When this happens away from your desk

At 3 a.m. the symptom is the same either way, a spike in 5xx or 504 errors, but the place to look differs: target health for an ALB, integration latency and throttles for API Gateway. CloudConsole is being built to show those alarms and logs on a phone with production guardrails.

[About the CloudConsole app](https://cloudconsole.dev/aws-console-app) · [Download on the App Store](https://apps.apple.com/app/cloudconsole-for-aws/id6835419710)

## Sources

- [Use Lambda functions as targets of an Application Load Balancer](https://docs.aws.amazon.com/elasticloadbalancing/latest/application/lambda-functions.html)
- [Amazon API Gateway quotas](https://docs.aws.amazon.com/apigateway/latest/developerguide/limits.html)
- [Choose between REST APIs and HTTP APIs](https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-vs-rest.html)

## Related

- [API Gateway REST API vs HTTP API](https://cloudconsole.dev/vs/api-gateway-rest-vs-http-api)
- [ALB vs NLB vs Gateway Load Balancer](https://cloudconsole.dev/vs/alb-vs-nlb)
- [Lambda vs Fargate](https://cloudconsole.dev/vs/lambda-vs-fargate)
- [504: Endpoint request timed out](https://cloudconsole.dev/errors/api-gateway-504-endpoint-request-timed-out)
- [429 Too Many Requests from API Gateway](https://cloudconsole.dev/errors/api-gateway-429-too-many-requests)
- [ALB 504 Gateway Timeout](https://cloudconsole.dev/errors/alb-504-gateway-timeout)

---

Source: https://cloudconsole.dev/vs/alb-vs-api-gateway

CloudConsole is an independent iPhone and Android app for Amazon Web Services by Cloudconcur Ltd. It is not affiliated with Amazon Web Services.
