AWS Application Load Balancer (ALB) vs API Gateway - Pricing

Zayd Simjee

Jun 14, 2021

AWS Application Load Balancer (ALB) vs API Gateway - Pricing

ALB and API Gateway have different feature sets. But how do they compare when it comes to pricing? A cost breakdown - and our recommendations.

API Gateway and Application Load Balancer (ALB) are both great ways to route and serve requests from wherever your services live. Both services can be used in tandem with Lambda, EC2, Fargate, and VPCs. However, the trade offs are opaque. Most people believe that API Gateway is under powered and expensive, while ALB is really powerful and cheap.

About this price comparison

While both services differ in ease of use and feature-sets, this post will be constrained to talking about cost to achieve certain objectives. I’ll work under the assumptions that API Gateway is easier to set up and more feature-rich out of the box. As the goal of this post is to demonstrate pricing differences between API Gateway and ALB, all prices and calculations will be done using the pricing in the AWS region us-east-1 at the time of this writing.

ALB vs API Gateway: total costs at scale

Let’s cost out a few common cases, all in log10 scale.

Requests with small responses

Chart comparing ALB and API Gateway cost at 5Kb per response.

ALB starts out more expensive but becomes cheaper at around 500,000 requests per day. This is a big number - API Gateway remains cheaper than ALB at a surprising scale. However, after 500,000 requests per day, API Gateway prices take off at a faster rate than ALB prices.

Requests with big responses

Chart comparing API Gateway and ALB cost at 1MB per response.

This graph is a little more surprising. This kind of scale is really atypical. However, for data intensive services, ALB gets expensive quite quickly at scale and surpasses APIG by 10 billion requests per day. Keep in mind, that’s assuming we’re shuffling an exabyte of data a day. So I’m not sure how useful that data point is.

ALB vs API Gateway: cost breakdown

It’s not easy to compare costs between API Gateway and ALB because they have totally different pricing models.

API Gateway pricing structure

API Gateway has a very simple pricing structure:

  • 1 million http requests per month are free
  • The next 299 million requests per month are billed at $1.00 per million requests
  • Any requests beyond that are billed at $0.90 per request

The other major cost is data transfer. Like most services, data transfer within the region is free. However, external data transfers are charged at standard EC2 transfer rates, which range from free to $0.09 per GB transferred.

There are some caveats and additional charges when using other features such as Private Link, Gateway Load Balancer endpoints, or Gateway Caching. That said, the overall pricing model is easy to understand and simulate.

ALB pricing structure

ALB pricing, on the other hand, isn't as easy to suss out. It uses a combination of a flat hourly charge ($0.0225 per hour) plus a per-minute charge based on the scale of your service. AWS abstracts this into a concept called Load Balancer Capacity Units (LCU) ($0.08 per hour).

LCUs are notoriously difficult to calculate. They rely on a number that represents the maximum weighted amount between connections the load balancer handles, how the load balancer evaluates rules, and how much data is transferred.

It’s worth noting that LCUs are automatically provisioned as your service heats up. In other words, there's no way to manually set the number of LCUs used. ALB is also more LCU-intensive when interacting with Lambda. In the calculations above, LCUs were always determined by the amount of data transferred.

Finally, in order to get some of the same functionality as we get with API Gateway, I’ve added Amazon Web Application Firewall (WAF) to our estimates.

ALB vs API Gateway: which should I use?

API Gateway is thought of as an expensive service. As shown above, while that may be the case at scale, for new or lightly-trafficked services, it’s pretty cheap and many services can take advantage of the 1 million request per month free tier.

Our recommendation

Based on our analysis, for most cases, it makes sense to use API Gateway to begin new services due to the out-of-the-box feature-set, ease of use, and cost at low scale. As applications become more complex or start to front a ton of requests (more than ~500,000 requests per day), it makes sense to switch to ALB. Using API Gateway is a small investment and it is easy to switch routing and load balancing services later.

As you can see in our stack architecture view below, building a stack with either of these options, as well as adding caching is just a couple of clicks.

Screenshot of TinyStacks interface: Starting a new build

Next Steps

To experience either of these services with your own app or one of our test projects, sign up for a free TinyStacks developer account, connect to a repo and an AWS account and deploy. The "sign up to code on the internet" process takes 10 to 15 minutes. Be sure to delete the ALB stack afterwards so you don't get charged the hourly rate!

Sources and references

ALB pricing - AWS

ALB cost estimation - CloudSoft

API Gateway pricing - AWS

WAF pricing - AWS

EC2 pricing - AWS


© 2022 TinyStacks, Inc. All rights reserved.