Distributing workloads across multiple computing resources is one of the most critical tasks in about any organization. Amazon AWS Elastic Load Balancer is a purpose built service for distributing workloads. This AWS load balancer tutorial blog will take you into the depths of AWS ELB. You will learn how an AWS ELB works, types of load balancers in AWS and more.
In this AWS ELB tutorial, we will cover the following topics in the same order:
- What is Amazon AWS Elastic Load Balancer (ELB)?
- How does an AWS ELB Work?
- Types of AWS Elastic Load Balancers
- Advantages of AWS ELB
Check this Intellipaat End to End AWS Tutorial video:
What is Amazon AWS Elastic Load Balancer?
Load balancer is a service which uniformly distributes network traffic and workloads across multiple servers or cluster of servers. Load balancer in AWS increases the availability and fault tolerance of an application. AWS Elastic Load Balancer is the single point of contact to all the clients, they can be sent to the nearest geographic instance or the instance with the lowest latency.
AWS Load balancer will distribute your workloads across multiple compute resources, such as a Virtual Machine or Virtual Server. The applications availability and fail over will decrease due to this. You can also let your load balancer take care of your encryption and decryption and let your compute services do their main work.
Get certified from top AWS course in Hyderabad Now!
But how to access a Amazon ELB?
There are multiple ways to that,
- AWS Management Console – Using the AWS web interface you can create load balancers
- AWS Command Line Interface – AWS provides a command line interface which is compatible in Mac, Windows, and Linux
- AWS SDKs – Language specific APIs are provided and can be used for any function using the load balancer or other services.
- Query API – This is the most direct way to call load balancers in AWS, but you must only use low-level API actions like sending HTTPs requests.
How does an AWS ELB Work?
The working of the AWS Elastic Load Balancer is very simple. The illustration above sums it all up.
Grab high-paying analytics jobs with the help of these Top AWS Interview Questions!
The basic working principle is the Elastic Load Balancer accepts incoming traffic from its clients and then routes requests to the targets which the client want. If the load balancer finds an unhealthy target, then it will stop redirecting it’s users there and will move with the other healthy targets until that target is declared healthy.
To make an AWS ELB accept incoming traffic you have to configure them by specifying one or more listeners. A listener is a process which will check for connection requests.
Availability zones – You can enable Availability Zones for your Amazon load balancer, then a load balancer node will be created in that Availability Zone. Enabling multiple Availability Zones and also make sure they at least have one registered target. Having at least one registered target will allow the load balancer to route traffic there. The advantage of having multiple AZs and targets will allow AWS load balancer to route traffic to other targets when few targets fail.
Now, let us have a look at different load balancers in AWS and their functionalities.
Types of AWS Elastic Load Balancers
There are mainly three types of Amazon load balancers:
- Classic Load Balancer
- Network Load Balancer
- Application Load Balancer
Classic Load Balancer
Classic Load balancer in AWS is used on EC2-classic instances. This is the previous generation’s load balancer and also it doesn’t allow host-based or path based routing.
The Classic Load balancer will route traffic to all registered targets in the Availability Zones, it doesn’t check what is in the servers in those targets. It routes to every single target. Mostly it is used to route traffic to one single URL.
Routing decisions can be taken in transport layer (TCP/SSL) or the application layer (HTTP/HTTPS). Currently, the Classic Load Balancers require a fixed connection between the load balancer port and container instance port.
Interested in learning AWS? Go through this AWS Tutorial!
Network Load Balancer
Network Load Balancer in AWS takes routing decisions in the Transport layer (TCP/SSL) of the OSI model, it can handle millions of requests per second. Widely used to load balancing the TCP traffic and it will also support elastic or static IP.
Let us see a simple example, you own a video sharing website which has decent traffic every day. One day, after a video on your website, went viral the website’s traffic is very high and you need an immediate solution to maintain it. AWS Network Load Balancer to the rescue!
AWS Network Load Balancer can be trusted in these types of situations. It can handle millions of requests and a sudden spike of traffic because it works at the connection level.
Application Load Balancer
An Application Load Balancer in AWS makes routing decisions at the application layer (HTTP/HTTPs) of the OSI model, thus the name Application Load Balancer. ALB supports path-based and host-based routing, we will look at them after learning how the ALB works.
The Application Load Balancer receives the route requests, then it inspects the received packets. Then it chooses the best target possible for the type of load and sends to the target with the highest efficiency.
Host-based Routing using ALB
If you have two websites, intellipaat.com and dashboard.intellipaat.com. Both of the websites are hosted in different EC2 instance and you want to distribute incoming traffic between them to make them highly available.
Normally, we would create two AWS load balancers using CLB, but using ALB it is possible with one and also your money is saved. Instead of paying for 2 ELBs, only pay for a single ELB.
Check our AWS SysOps Associate Certification and learn AWS SysOps from industry experts.
Path-based Routing using ALB
In this type of routing, the websites URL path will be hosted on different EC2 instances. For example, consider intellipaat.com and intellipaat.com/tutorial and these URL paths are hosted on different EC2 instances. Now, if you want to route traffic between these two URLs then you can use a path-based routing method. ALB can be used to solve this problem too, you can use traffic routing according to the path feature by using just one ALB.
Cross-Zone Load Balancing
By default CLB nodes distributes traffic to instances in its availability zone only. Enable cross-zone load balancing to route evenly across EC2 instances. If cross-zone load balancing is disabled, the load balancer will only distribute traffic to instances in its Availability Zone. Enabling it will evenly distribute traffic across all AZs where registered targets are available.
Advantages of AWS ELB
- Highly Available
- ELB distributes traffic evenly among all the targets, for example multiple EC2 instances.
- ELB has an SLA of 99.99%
- ELB let’s you route traffic with the application’s IP address, this allows you launch multiple applications in a single instance.
- Highly secure
- You can implement robust security features using Amazon VPC with Amazon ELB
- Elastically scalable
- ELB can handle sudden spikes in traffic and can handle millions of requests per second. Whenever there is a traffic increase, AWS auto scaling feature will be enabled and also load balancing rules will be used to provide the website users an seamless performance
- Hybrid load balancing
- You can use the same Amazon load balancer to balance across applications on your on-premises set up and you AWS infrastructure. Now, it will be very easy to migrate your application from on-premise to AWS cloud.
- Robust monitoring and auditing
- Applications and their performance can be monitored and maintained. You can also use CloudWatch metrics and logs to analyze our applications data, traffic, and working.
I Hope this helped you understand Elastic Load Balancers in AWS. If you wish to pursue learning AWS in depth then you can also check out AWS Certification Training. Stay tuned for more tutorials on Amazon Web Services.