3 Reasons To Use HAProxy with AWS ELB

I stumbled upon this question – why do I need HAProxy when it serves nearly the same function AWS ELB (Amazon Web Services – Elastic Load Balancer), and sometimes even that of the application load balancer. I could get to the right answer after dedicating a good time to the search, one which finally was convincing.

Before I go ahead with the 3 reasons as to why HAProxy is used with AWS ELB, let us cover few basic terminologies.

What is AWS ELB?

AWS Elastic Load Balancer (ELB) automatically distributes incoming application traffic across multiple targets. These can be Amazon EC2 instances, containers or IP addresses. It can handle the real time varying load of your traffic. It provides features like such as –

  • high availability
  • automatic scaling
  • security
  • fault tolerance
  • health monitoring

What is HAProxy?

HAProxy, where HA stands for High Availability, is an open source software providing TCP/HTTP load balancing and proxying solution. It distributes the workload across multiple servers (either web, application or database). This considerably improves the performance and reliability of a server.

Oh, in case you want to refresh on what a “proxy” means in the computing terminology, here it is! A proxy server is an intermediary server between end users and the websites they browse. They provide varying levels of functionality, security, and privacy depending on your use case. If you’re using a proxy server, internet traffic flows through the proxy server to the address you requested. The request then comes back through that same proxy server (there are exceptions to this rule), and then the proxy server forwards the data received from the website to you.

When To Use HAProxy with AWS ELB

Well, the most essential factors are the following-

  • AWS ELB has it’s limitation with the types of load balancing algorithms it offers. It supports only round robin and session stickiness. But in case you need to load the balancer based on incoming URL, or on the number of connections to be handled by an individual underlying sever among many, HAProxy can handle those, and more!
  • An Elastic Load Balancer can’t be associated with a static IP address – or even a range of IPs. It can therefore be difficult to create a whitelist to filter traffic coming through an ELB balancer. On the other hand, you could always set up HAProxy on an EC2 instance and assign an Elastic IP address to that instance. That IP can then easily be used in your firewall to whitelist requests.
  • Pricing! AWS charges you on hourly basis, over which your Elastic Load Balancer is running. You are also charged for each GB of data transferred through your Elastic Load Balancer. However, as HAProxy is open source, setting it up and running it on an EC2 instance will only cost you the normal instance usage.

On an ending note, I hope this information helps you!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.