Free Trial

AWS ELB vs. NGINX Load Balancer

When building a new application or microservice on AWS, there are several options for handling load balancing in front of the application. In this article, I’ll explain and compare two of the most common and robust options: The built-in AWS Elastic Load Balancer (ELB)  or more commonly known as AWS ELB and NGINX’s load balancer.

Why the Difference Matters

When it comes to choices, choosing your load balancing option may not seem like an important choice, or even be that exciting to some. And it’s true that in most cases, either ELB or NGINX will work.

But there are important differences between them, and the decision you make for handling load balancing will set the tone for other infrastructure decisions going forward. It shapes the architecture of your apps and your deployment patterns. That’s why it’s worth taking time to evaluate both options before committing to one.

AWS Elastic Load Balancing

AWS defines ELB as follows:

“Elastic Load Balancing automatically distributes your incoming application traffic across multiple targets, such as EC2 instances. It monitors the health of registered targets and routes traffic only to the healthy targets. Elastic Load Balancing supports two types of load balancers: Application Load Balancers and Classic Load Balancers.”

aws-elb-classic-load-balancer

source: AWS What is a Classic Load Balancer.

 

ELB Strengths

  • High performance
  • Popular feature on AWS platform
  • Commercial support available if desired or required
  • Classic Load Balancer can load-balance any TCP traffic
  • Application Load Balancers can handle route HTTP traffic based on content
  • Can handle SSL Termination
  • Seamlessly interacts with other AWS services like CloudFront for content optimization
  • Differentiator
  • Enforces highly available configuration by requiring a target subnet in two availability zones, and does not require system administration knowledge

Detractors

  • Separate Load Balancer instances required to support multiple applications or services
  • Limited support for any kind of translation, including port translation

Costs
These are the minimum costs associated with ELB in a highly available configuration that handles one connection per minute with two kilobytes of data transfer on AWS.

Application Load Balancer would cost $22.88 USD per month

  • $0.0225 per Application Load Balancer-hour
  • $0.008 per LCU-hour

Classic Load Balancer would cost $18.77 USD

  • $0.025 per Elastic Load Balancer-hour
  • $0.008 per GB of data processed

NGINX

The NGINX project describes NGINX as follows:
“NGINX [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP/UDP proxy server, originally written by Igor Sysoev. For a long time, it has been running on many heavily loaded Russian sites, including Yandex, Mail.Ru, VK, and Rambler. According to Netcraft, NGINX served or proxied 29.10% of the busiest sites in June 2017.”

source: nginx Tech Blog.

NGINX Strengths

  • High performance
  • Popular, with lots of community support
  • Commercial support available if desired or required
  • Can load-balance any TCP traffic
  • Can handle SSL termination for any connection type
  • For HTTP traffic, can handle routing based on content of the request

Differentiator

  • Supports additional modules, including caching and PHP-FPM
  • Much more robust logging available, which can be very helpful at times

Detractors

  • Extra effort and more advanced knowledge required to install, configure, and keep packages updated
  • NGINX high availability is not an “out of the box feature” in the free version

Costs
These are the minimum costs associated with NGINX in a highly available configuration that handles one connection per minute with two kilobytes of data transfer on AWS.

The software is free, unless you chose to buy NGINX Plus, which starts at $2,500 USD per instance, but it handles high availability deployments seamlessly in addition to commercial support with service level agreements.

Two t1.micro instances sharing an Elastic IP ($0.012 per hour each) plus the data transfer (as much as $0.09 per GB) would cost $18.11 USD per month.

AWS ELB vs. nginx

It’s worth noting that although this article compares the two products, in reality, they are often used together. For example, in many stacks, ELB handles public-facing IPs and SSL termination, and balances traffic between multiple NGINX nodes across availability zones, while the NGINX servers handle caching and passing traffic to the actual application/service layer via fpm or as a reverse proxy—so you don’t necessarily need to think of ELB and NGINX as an either-or choice. You may best be served by using both.

 

Features ELB NGINX Load Balancer
Commercial Support Available Yes Yes
Cost $0.025 per ELB-hour + $0.008 per GB data  Free
Enforces High Availability by default? Yes No (Unless you use NGINX Plus)
Traffic Protocol TCP TCP

 

When singling one out, either ELB or NGINX are reasonable options, and the costs of each are similar when starting out. The main differentiator comes down to selecting whether you want to control the full stack, right down to the operating system, and take advantage of extra features like caching without adding more layers to the application. In that case, NGINX will be a better choice. Alternatively, if you want to simplify how much infrastructure you need to build and maintain by leveraging features that are built into AWS, ELB is your solution.

Get Started Today!

Sign up for your FREE Sumo Logic Trial.

Free Trial
Sign up for your 30 day free trial!
Sign up for
Sumo Logic Free
  • No credit card required to sign-up
  • Create your account in minutes
  • No expiration date
  • After 30 day trial period, reverts to Sumo Logic Free
    View All Pricing Options Privacy Policy