AWS’s Elastic Load Balancer (ELB) offers customers an easy way to handle load balancing for applications hosted on multiple Amazon EC2 instances. While using AWS ELB, there’s no need to worry about failover and availability – all that is managed by AWS. In this post, we’ll focus on some key features and then run a useful AWS ELB vs HAProxy comparison.
Distributing and efficiently balancing incoming traffic is a basic and critical requirement for most web applications. Load balancers help to distribute and balance traffic based on different algorithms to filter for effects like round robin, session affinity, geographical location, and latency. Load balancers have been around for long enough that they’re part of a fully matured market. Both hardware and software balancers are widely available.
Still, while placing a load balancer in front of your application will definitely improve performance, it does carry some overhead, including setup and maintenance costs, and the need to ensure high availability and properly handle failure.
ELB vs HAProxy: ELB concepts
Load balancer types
In Amazon’s architectural design, a Virtual Private Cloud (VPC) is an isolated network into which you can launch compute resources. If you have Internet-facing instances in a public availability zone within a VPC, you would place an external load balancer on top of your resources to manage traffic. For devices inside a VPC’s private availability zone (for a corporate intranet, for example), you could deploy an internal load balancer.
ELB supports SSL termination at the load balancer itself, removing the need to manage SSL certificates at the application instance level. Flexible cipher support allows you to control the ciphers and protocols the load balancer presents to clients.
Sticky sessions are central to the design of many web applications, and developers will usually need to write extra code to implement the feature. ELB can take over this task, allowing you to configure session stickiness in just a few steps…again, at the load balancer level.
Monitoring a load balancer can help you to identify all kinds of performance related issues related to metrics like request latency, request counts, and failed request counts. The data provided by Amazon CloudWatch can greatly simplify the monitoring process, leaving you free to concentrate on application development.
Using access logs to properly analyze web traffic or to diagnose application behavior is obviously very important. However, since AWS manages ELB – effectively keeping you away from the underlying hardware – you can’t get to your logs the way you normally would on servers that you manage directly. Enabling Access Logs and pointing to the S3 bucket where you’d like your logs stored will cause all relevant log data to be transferred to S3. From there, you’ll be able to analyze away to your heart’s content.
Before a load balancer can redirect requests to a server, it’s important to determine the availability (or health) of the underlying server/application. By pointing your balancer’s health check to a custom application endpoint, its status will be regularly monitored. Health checks will then try to ping, say, your index.html page. If it receives a “200” response code, then it will assume everything is fine. “400” responses would mean there’s trouble, and traffic could be routed away from that server.
ELB vs HAProxy
There may be times when you won’t want to use a load balancer provided by AWS. For instance,
- You may prefer an open source solution.
- You may wish to avoid vendor lock in.
- You don’t want to give up control over load balancer management and security.
For such scenarios you should be able to intelligently compare ELB vs HAProxy, a widely-adopted open source (software-based) load balancer. Besides being fairly simple to configure, here are some of the things that HAProxy does well:
- When comparing ELB vs HAProxy, the former can feel a bit limited as far as load balancing algorithms are concerned. It supports only round robin and session stickiness. But consider cases where you need to load the balancer based on incoming URL, or on the number of connections to be handled by individual underlying severs. 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 may or may not be a big deal for you, but it can’t hurt to bring it up. AWS charges you for each hour or partial hour that your Elastic Load Balancer is running, and for each GB of data transferred through your Elastic Load Balancer. Since HAProxy is open source, on the other hand, setting it up and running it on an EC2 instance will cost you nothing more than the normal instance usage.
You definitely shouldn’t think I’ve got anything against AWS ELB. In fact, they’re constantly improving their product. Rather, I’ve simply tried to present various scenarios that can have more than one possible solution. It’s up to you to compare ELB vs HAProxy (along with other options) and choose whatever will work best for you.
Therefore, if your business doesn’t require complex load balancing algorithms, and is fine with simple round robin patters then I would recommend ELB for its simplicity. Similarly, if your applications are deployed across different availability zones within an AWS region and the servers are running as part of an auto scaling group, then it will be much easier to seamlessly integrate your AWS resources if you use ELB.
Trying to get the same just done with HAProxy might not be quite so simple.
This post was intended to help you understand some key ELB features and, at the same time, introduce you to an important open source load balancer solution (HAProxy). The rest is up to you.
If you’d like to add your own thoughts on the ELB vs HAProxy conversation, please leave a comment.
If you want to get a jump start on ELB, check out Cloud Academy’s Introduction to ELB course.
New Content: Azure DP-100 Certification, Alibaba Cloud Certified Associate Prep, 13 Security Labs, and Much More
This past month our Content Team served up a heaping spoonful of new and updated content. Not only did our experts release the brand new Azure DP-100 Certification Learning Path, but they also created 18 new hands-on labs — and so much more! New content on Cloud Academy At any time, y...
AWS Certification Practice Exam: What to Expect from Test Questions
If you’re building applications on the AWS cloud or looking to get started in cloud computing, certification is a way to build deep knowledge in key services unique to the AWS platform. AWS currently offers 12 certifications that cover major cloud roles including Solutions Architect, De...
Overcoming Unprecedented Business Challenges with AWS
From auto-scaling applications with high availability to video conferencing that’s used by everyone, every day — cloud technology has never been more popular or in-demand. But what does this mean for experienced cloud professionals and the challenges they face as they carve out a new p...
Constant Content: Cloud Academy’s Q3 2020 Roadmap
Hello — Andy Larkin here, VP of Content at Cloud Academy. I am pleased to release our roadmap for the next three months of 2020 — August through October. Let me walk you through the content we have planned for you and how this content can help you gain skills, get certified, and...
New Content: Alibaba, Azure AZ-303 and AZ-304, Site Reliability Engineering (SRE) Foundation, Python 3 Programming, 16 Hands-on Labs, and Much More
This month our Content Team did an amazing job at publishing and updating a ton of new content. Not only did our experts release the brand new AZ-303 and AZ-304 Certification Learning Paths, but they also created 16 new hands-on labs — and so much more! New content on Cloud Academy At...
Blog Digest: Which Certifications Should I Get?, The 12 Microsoft Azure Certifications, 6 Ways to Prevent a Data Breach, and More
This month, we were excited to announce that Cloud Academy was recognized in the G2 Summer 2020 reports! These reports highlight the top-rated solutions in the industry, as chosen by the source that matters most: customers. We're grateful to have been nominated as a High Performer in se...
Which Certifications Should I Get?
The old AWS slogan, “Cloud is the new normal” is indeed a reality today. Really, cloud has been the new normal for a while now and getting credentials has become an increasingly effective way to quickly showcase your abilities to recruiters and companies. With all that in mind, the s...
New Content: AWS, Azure, Typescript, Java, Docker, 13 New Labs, and Much More
This month, our Content Team released a whopping 13 new labs in real cloud environments! If you haven't tried out our labs, you might not understand why we think that number is so impressive. Our labs are not “simulated” experiences — they are real cloud environments using accounts on A...
Kickstart Your Tech Training With a Free Week on Cloud Academy
Are you looking to make a jump in your technical career? Want to get trained or certified on AWS, Azure, Google Cloud Platform, DevOps, Kubernetes, Python, or another in-demand skill? Then you'll want to mark your calendar. Starting Monday, June 22 at 12:00 a.m. PDT (3:00 a.m. EDT), ...
New Content: AZ-500 and AZ-400 Updates, 3 Google Professional Exam Preps, Practical ML Learning Path, C# Programming, and More
This month, our Content Team released tons of new content and labs in real cloud environments. Not only that, but we introduced our very first highly interactive "Office Hours" webinar. This webinar, Acing the AWS Solutions Architect Associate Certification, started with a quick overvie...
Azure vs. AWS: Which Certification Provides the Brighter Future?
More and more companies are using cloud services, prompting more and more people to switch their current IT position to something cloud-related. The problem is most people only have that much time after work to learn new technologies, and there are plenty of cloud services that you can ...
Blog Digest: 5 Reasons to Get AWS Certified, OWASP Top 10, Getting Started with VPCs, Top 10 Soft Skills, and More
Thank you for being a valued member of our community! We recently sent out a short survey to understand what type of content you would like us to add to Cloud Academy, and we want to thank everyone who gave us their input. If you would like to complete the survey, it's not too late. It ...