What is Elastic Load Balancing?
Most network engineers are faced with the dilemma of working with clunky and proprietary load balancing algorithms requiring expensive and specialized hardware on a regular basis. Fortunately, Companies who are using the popular cloud computing services provided by Amazon Web Services (AWS) can leverage Elastic Load Balancing (ELB), a virtual load balancer that you can activate to work with your Cloud Infrastructure provided it is hosted with AWS.
Old load balancing and new ELB (Elastic Load Balancing)
Growing companies, at some point, will have to upgrade their infrastructures to handle increased network traffic to sate their customer’s demands. For this exact reason, numerous solutions have been proposed; customized hardwares and appliances, and proprietary protocols among others, as part of the vendor’s attempt to address the demanding requirements for high reliability, scalability, and availability. Well, it goes without saying that the IT staff has mission-critical responsibilities for the optimal operation of the network infrastructure and is required to learn all of the technologies that the vendors have implemented to provide adequate support on the system. This has always been the typical handover process. Thankfully, Elastic Load Balancing (ELB) alleviates this cumbersome task since the entire setup and configuration of ELB is quite intuitive with its Graphical User Interface (GUI) which I am going to demonstrate here. ELB, at its core, is a simple technology where the common man and the less tech-savvy will be able to grasp and understand. Overall, it is a lifesaver and an enormous step-up compared to the traditional load balancers setup.
Configuring ELB Classic Load Balancer
Amazon offers three ELB types depending namely Application Load Balancers, Network Load Balancers, and Classic Load Balancers on your requirements. For testing purpose, we are going to configure an ELB Classic Load Balancer.
Configure the Load Balancer name and ports along with related instances.
- I named by Load Balancer as MyFirstELB.
- For the Load Balancer to function properly, It needs to be on the same network as my VPC instance My Default VPC.
- I configured HTTP listener since the LB will direct traffic for web servers.
Configure the requisite Security Groups in a VPC
Security groups are mandatory for the load balancer in order to allow inbound traffic to the assigned load balancer ports. I selected the pre-configured security group sg-97718df0 that will allow the traffic for the load balancer. As this is only for testing purpose, I did not configure a secure listener.
Enable Health Checks for Pool Members/Instances
Periodic health checks for pool members/instances can be configured as an added feature of ELB. This is very important because ELB needs to pinpoint the offline member/instance in order to redirect the traffic to the online member/instance.
- Since I am configuring web servers, I enabled health checks to HTTP protocol on port 80. Next, I configured Ping Path to /index.html so that ELB can do the health query on the web server’s home page.
- Additional details can be configured such as the timeout, internal, and threshold values.
Connect Web Server instances with ELB load balancer
The load balancer can only distribute traffic between instances that are registered to it. This is done by configuring the instance with elastic network interface since the load balancer routes traffic to the Web servers instance primary interface.
Check the load balanced service
Before you create the load balancer, review the settings that you selected. After creating the load balancer, you can verify that it’s sending traffic to your EC2 instances.
- Enter the DNS configured for your ELB (for example, MyFirstELB-1234567890.us-east.elb.amazonaws.com) and load it in a browser. Verify the AWS Console that all instances are up and running. If the load balancer is configured properly, the web page will load properly as shown below. Traffic request will distribute between Web server instance 1 and instance 2.
- URL content provided by instance 1
- URL content provided by instance 2
Remote the Trial Load Balancer Setup
Amazon runs on a Pay-Per-Use model so the test load balancer needs to be deleted to prevent incurring charges for it. I learned this the hard way after doing multiple test environments in AWS and receiving a hefty bill the following month. Please learn from my mistake.