Back to blog results

October 5, 2017By Vince Power

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.

Try the Sumo Logic App for AWS Log Analytics

See how Sumo Logic helps analyze raw AWS ELB data and get started with a free trial today.

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.

What is 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.”

Classic ELB distributing incoming application traffic across multiple EC2 instances

source: AWS What is a Classic Load Balancer.

AWS ELB Benefits

  • 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

AWS ELB Disadvantages

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

AWS ELB 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

What is 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.”

nginx-asg-sync constantly monitors Auto Scaling groups and learns about changes via the AWS Auto Scaling API

source: nginx Tech Blog.

NGINX Benefits

  • 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

NGINX Differentiator

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

NGINX Disadvantages

  • 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

NGINX 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.

FeaturesELBNGINX Load Balancer
Commercial Support AvailableYesYes
Cost$0.025 per ELB-hour + $0.008 per GB dataFree
Enforces High Availability by default?YesNo (Unless you use NGINX Plus)
Traffic ProtocolTCPTCP

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.

Additional Resources

Try the Sumo Logic App for AWS Log Analytics

See how Sumo Logic helps analyze raw AWS ELB data and get started with a free trial today.

Vince Power

Vince Power is a member of the Sumo Logic Community. He's a Solution Architect who has a focus on cloud adoption and technology implementations using open source-based technologies. He has extensive experience with core computing and networking (IaaS), identity and access management (IAM), application platforms (PaaS), and continuous delivery.

More posts by Vince Power.

People who read this also enjoyed