The Cloud Engineers

The Cloud Engineers

Share this post

The Cloud Engineers
The Cloud Engineers
Amazon API Gateway vs Elastic Load Balancer: Which one to choose?
Copy link
Facebook
Email
Notes
More
User's avatar
Discover more from The Cloud Engineers
Level up your Cloud engineering knowledge with this weekly newsletter. Perfect for Software Engineers, Architects, DevOps engineers, and other tech enthusiasts looking to advance their careers while mastering the latest Cloud technologies.
Already have an account? Sign in

Amazon API Gateway vs Elastic Load Balancer: Which one to choose?

Lefteris Karageorgiou's avatar
Lefteris Karageorgiou
Mar 13, 2025
2

Share this post

The Cloud Engineers
The Cloud Engineers
Amazon API Gateway vs Elastic Load Balancer: Which one to choose?
Copy link
Facebook
Email
Notes
More
2
Share

As a Solutions Architect working with AWS services, I've seen many teams struggle with choosing between Amazon API Gateway and Elastic Load Balancer (ELB) for their applications. Both serve as entry points to your infrastructure but are designed for different purposes. In this post, I'll share practical insights on when to use each service, how they can work together, and how to make the right choice for your specific needs.

Thanks for reading The Cloud Engineers Newsletter! Subscribe for free to receive new posts and support my work.

The Core Differences at a Glance

Before diving into use cases, let's quickly understand what each service is optimized for:

API Gateway is a fully managed service specifically designed for API management, offering features like request validation, authentication, throttling, and API version management.

Elastic Load Balancer (ELB) primarily distributes incoming traffic across multiple targets (like EC2 instances, containers, or IP addresses) to ensure high availability and fault tolerance. The 2 most common types of ELB are Application Load Balancer (ALB), which operates at the application layer (Layer 7) and supports HTTP and HTTPS, and Network Load Balancer (NLB), which operates at the transport layer (Layer 4) and supports TCP, UDP, and TLS.

When to Choose API Gateway

1. Building RESTful or WebSocket APIs

API Gateway shines when you're building APIs that need to be consumed by mobile apps, web applications, or other services. For example a fintech startup can use API Gateway to create a payment processing API that handles authentication, rate limiting, and request validation before the requests even reach their backend services.

# Example API Gateway REST API endpoint structure
/api/v1/payments
  GET - retrieve payments
  POST - create new payment
  
/api/v1/payments/{id}
  GET - get specific payment
  PUT - update payment
  DELETE - cancel payment

2. Serverless Architectures

If you're building with Lambda functions, API Gateway is practically a default choice. It provides the HTTP/WebSocket endpoint that triggers your functions and manages the request/response cycle.

3. When You Need API-Specific Features

Choose API Gateway when you need:

  • Request/response transformations

  • API keys and usage plans

  • Schema validation

  • OAuth/Custom authorizers

  • CORS support

  • API documentation via Swagger/OpenAPI

4. Fine-Grained Access Control

When implementing microservices where different endpoints need different security policies, API Gateway's resource policies and integration with IAM, Cognito, and Lambda authorizers provide much more flexibility than what ELB offers.

When to Choose Elastic Load Balancer

1. High-Volume Web Applications

For a high-traffic e-commerce platform I worked with, we chose Application Load Balancer (ALB) to distribute traffic across dozens of EC2 instances. ELB was the better choice because it handled millions of requests per hour without the per-request pricing model of API Gateway.

2. Traditional Multi-Tier Applications

If you have traditional web applications running on EC2 instances or containers:

Client → Application Load Balancer → EC2 instances/ECS containers → Database layer

3. TCP/UDP Traffic or Pure WebSocket Applications

Network Load Balancer (NLB) is ideal when you need to handle non-HTTP traffic or when extreme performance and low latency are crucial.

4. When You Need SSL Termination for Web Applications

Application Load Balancer can handle SSL termination for your web applications, reducing the compute burden on your servers.

Using Both Together: A Layered Approach

In many real-world architectures, I've implemented both services together to get the best of both worlds:

Internet → API Gateway (for API management) → ALB (for load distribution) → EC2/ECS/EKS

This approach makes sense when:

  1. You need API management features but have non-Lambda backends: For example, a media streaming company can use API Gateway for authentication and rate limiting but have their video processing running on EC2 instances behind an ALB.

  2. You have a mix of serverless and container/VM workloads: API Gateway can route different API paths to different backends - some to Lambda and others to your ALB-fronted services.

# Example architecture
/api/users/* → Lambda functions
/api/content/* → ALB → Container services
  1. You want to gradually migrate from EC2 to serverless: Starting with an ALB and gradually moving some endpoints to API Gateway + Lambda can be a practical migration strategy.

Practical Decision Framework

When deciding between the two, ask yourself these questions:

  1. Are you primarily building APIs? If yes, start with API Gateway.

  2. Is your application traditional web-based or a mix of HTTP and non-HTTP protocols? If yes, start with ELB.

  3. Is cost a major concern with high traffic volume? If yes, ELB might be more economical as API Gateway charges per request.

  4. Do you need fine-grained API controls? If yes, API Gateway provides more API-specific features.

  5. Is your primary concern distributing load across a fleet of servers? If yes, ELB is purpose-built for this.

Performance and Cost Considerations

API Gateway

  • Latency: Adds a small overhead (typically 10-50ms)

  • Cost: Pay per request (around $3.50 per million requests) + data transfer

  • Scaling: Handles millions of requests without configuration

Elastic Load Balancer

  • Latency: Very low added latency (single-digit ms)

  • Cost: Hourly charge + LCU (Load Balancer Capacity Units) + data transfer

  • Scaling: Scales automatically but may require pre-warming for sudden traffic spikes

Conclusion

In my years working with AWS architectures, I've found that the choice between API Gateway and ELB isn't always either/or. Often, the best architectures leverage both services for what they do best.

API Gateway excels at API management, security, and serverless integrations, while ELB provides cost-effective, high-performance load distribution for your compute resources.

Understanding these differences has helped me design more efficient, scalable, and cost-effective cloud architectures for clients across various industries. I hope these practical insights help you make the right choice for your specific use cases.

Thanks for reading The Cloud Engineers Newsletter! Subscribe for free to receive new posts and support my work.

Lefteris Karageorgiou's avatar
Germain Safari's avatar
Tony's avatar
2 Likes∙
2 Restacks
2

Share this post

The Cloud Engineers
The Cloud Engineers
Amazon API Gateway vs Elastic Load Balancer: Which one to choose?
Copy link
Facebook
Email
Notes
More
2
Share

Discussion about this post

User's avatar
From Beginner to AWS Certified: A Roadmap for the Solutions Architect Associate Exam
Earning the AWS Certified Solutions Architect - Associate (SAA-C03) certification demonstrates your expertise in designing distributed systems on AWS.
Mar 6 â€¢ 
Lefteris Karageorgiou
10

Share this post

The Cloud Engineers
The Cloud Engineers
From Beginner to AWS Certified: A Roadmap for the Solutions Architect Associate Exam
Copy link
Facebook
Email
Notes
More
1
Optimizing Amazon S3 for High-Throughput Applications
In today's data-driven world, applications frequently need to handle massive volumes of data with minimal latency.
May 14 â€¢ 
Lefteris Karageorgiou
5

Share this post

The Cloud Engineers
The Cloud Engineers
Optimizing Amazon S3 for High-Throughput Applications
Copy link
Facebook
Email
Notes
More
When to Use RDS vs DynamoDB on AWS: Making the Right Database Choice
As Cloud Engineers/Architects working with AWS, one of the most consequential architectural decisions we face is selecting the right database service…
May 28 â€¢ 
Lefteris Karageorgiou
4

Share this post

The Cloud Engineers
The Cloud Engineers
When to Use RDS vs DynamoDB on AWS: Making the Right Database Choice
Copy link
Facebook
Email
Notes
More

Ready for more?

© 2025 Lefteris Karageorgiou
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More

Create your profile

User's avatar

Only paid subscribers can comment on this post

Already a paid subscriber? Sign in

Check your email

For your security, we need to re-authenticate you.

Click the link we sent to , or click here to sign in.