|What is AWS Elastic Load Balancer?|
|How does an AWS ELB Work?|
|AWS ELB Target Types|
|AWS ELB Components Architecture|
|Types of AWS Elastic Load Balancers|
|Benefits of AWS Elastic Load Balancer|
In case incoming traffic is automatically split across several targets, including EC2 instances, containers, and IP addresses in one or more Availability Zones, thanks to elastic load balancing. It monitors the condition of the registered targets, delivering traffic only to those who are healthy. Elastic load balancing modifies your load balancer as the amount of incoming traffic varies over time. It can automatically scale to accommodate the vast majority of workloads.
What is AWS Elastic Load Balancer?
AWS Elastic Load Balancer (ELB) is capable of diverting incoming application traffic among different targets, such as containers, AWS EC2 instances, and IP addresses, located in one or more availability zones. This ensures that frontend traffic is evenly distributed across backend servers, thereby enhancing the fault tolerance and service availability of user applications. Additionally, the load balancing feature of AWS also tracks the health of registered targets, and routes traffic accordingly.
How does an AWS ELB Work?
The fundamental concept behind the Elastic Load Balancer is that it receives traffic from its clients and directs requests to the desired targets. If the load balancer detects that a target is not functioning properly, it will stop routing users to that target, instead opting for other healthy targets until the original target is restored.
To enable AWS ELB to receive incoming transmissions, one has to set it up by indicating one or more listeners. A listener acts as a monitor to detect connection requests.
When using Amazon’s load balancer, you can set up Availability Zones to ensure that load balancer nodes are created in those Zones. To ensure that the load balancer can handle your traffic, make sure to register at least one target in each Availability Zone. The benefit of having multiple Zones and targets is that the load balancer can reroute traffic to other targets if some of the primary ones fail.
AWS ELB Target Types
Elastic Load Balancer distributes incoming traffic to:
- Instances, such as EC2, EC2 with Auto Scaling, and Containers with ECS
- IP addresses, like VPC Subnets, RFC 1918 CIDR, and On-premises with Direct Connect or Site-to-Site VPN
- Lambda functions (applicable for ALB type)
AWS ELB Components Architecture
An ELB load balancer works as a single access point for customers and spreads incoming application traffic to a number of operational registered targets, such as EC2 instances, located in numerous Availability Zones.
The Listener will monitor for requests from clients that have been set up using the particular protocol and port. Its purpose is to direct the inbound connections to the intended target groups using rules. It is mandatory to configure at least one listener for each load balancer.
The rules that you set for a listener decide how the load balancer guides requests to its enlisted targets. Every rule is composed of a priority, one or more activities, and one or more conditions. Each listener has a base rule, and you can pick to specify extra rules.
A target group is a collection of resources that an ELB (Elastic Load Balancer) should direct requests to. It is possible to configure an ELB with different target groups which are associated with unique listener rules and configurations.
Each target group routes inquiries to one or more registered targets, like EC2 instances, employing the protocol and port number that has been indicated. It is also possible to register a target to multiple target groups.
To evaluate the accessibility of your targets (e.g. EC2 instances), a load balancer intermittently transmits pings, attempts connections, or sends requests to verify the EC2 instances. These tests are known as health checks. It is possible to modify health checks on a per target group basis.
Types of AWS Elastic Load Balancers
The Amazon Web Services platform offers four types of load balancers.
- AWS Classic Load Balancer
- AWS Network Load Balancer (NLB)
- AWS Application Load Balancer (ALB)
- AWS Gateway Load Balancer (GLB)
The AWS classic type of load balancer is only recommended for those who have instances running on EC2-Classic network. All other users should switch to either AWS Network Load Balancer (NLB) or AWS Application Load Balancer (ALB). The AWS Gateway Load Balancer can’t distribute the traffic across multiple targets, so its usage is limited.
AWS Classic Load Balancer
Classic Load Balancer is the traditional form of load balancer that was used and it distributes the traffic among the instances, however it is not smart enough to offer host- or path-based routing, which leads to a decline in efficiency and performance in some cases. This type of load balancer works on both connection and request levels, and is situated between the transport layer (TCP/SSL) or the application layer (HTTP/HTTPS).
The Classic Load balancer is designed to send traffic to all the targets that have been registered in the Availability Zones, without considering the content of the servers in those locations. It will direct traffic to each of the targets, but it is usually employed when traffic is to be sent to a single URL.
AWS Network Load Balancer
This kind of load balancer functions at the transport layer (TCP/SSL) of the OSI model and is adept in managing a huge number of requests per second. It is generally used for load balancing TCP traffic. According to AWS, the Network Load Balancer (NLB) is the most suitable for apps that require a static IP address and exceptional performance. Compared to the AWS Application Load Balancer, the NLB is more suitable for handling unpredictable and explosive traffic patterns, as well as applications that change rapidly.
AWS Application Load Balancer
This form of Load Balancer is utilized when determinations must be taken regarding HTTP and HTTPS traffic routing.
The Application Load Balancer (ALB) is an OSI layer 7 load balancer which routes packets according to the data they contain to different backend services. This is in contrast to the classic AWS elastic load balancer which requires one to be running for each service. An AWS application load balancer provides layer 7 load balancing which can spread the load of various backend services.
The load balancer is capable of utilizing path-based and host-based routing. Additionally, it is able to support dynamic host port mapping.
AWS Gateway Load Balancer
Gateway Load Balancers enables you to implement, increase, and control virtual instruments such as a firewall. Gateway Load Balancers then synthesizes a semi-transparent network gateway and divides the traffic.
Gateway Load Balancers offers the capacity to deploy, expand, and control virtual appliances, for example, firewalls. GLBs combine a transparent network gateway thereby distributing the traffic.
Benefits of AWS Elastic Load Balancer
- High availability: The ELB distributes traffic evenly across all of its targets. ELB guarantees a SLA of 99.99%
- Secure: Amazon VPC and Amazon ELB can be employed to create effective security measures. By providing SSL/TLS decryption and user authentication, a high standard of security can be achieved.
- Flexible: Utilizing ELB, it is possible to direct traffic using the application’s IP address, thereby making it feasible to initiate multiple applications on a single instance.
- Elastic Scalability: ELB is capable of handling abrupt spikes in web traffic and can process millions of requests each second. When there is a surge in visitors, the AWS auto scaling feature will be activated and load balancing protocols will be employed to deliver a consistent user experience on the website.
- Hybrid load balancing: The same Amazon load balancer can be applied to both your on-premise setup and your AWS infrastructure, making the process of migrating your application from physical servers to the AWS cloud much simpler.
- Auditing & Monitoring: Regular auditing and surveillance can be insightful for your applications. It is also possible to employ CloudWatch metrics and logs to study applications data, usage, and operation.
How to Configure AWS Load Balancer?
- Use the AWS Management Console interface that is available online to set up and customize an AWS load balancer.
- Select two distinct Availability Zones in which to deploy your EC2 instances.
- For each Availability Zone, configure a minimum of one public subnet in the VPC; these are then employed to configure the load balancer. (Additionally, users can initiate EC2 cases in other subnets of the availability zones)
- It is necessary that each availability zone contains one or more EC2 instances that have a web server like, Ngnix or Apache, configured.
- It is essential for the security groups to enable HTTP access for these instances through port 80.
Step-by-Step Configuration of AWS Application Load Balancer (ALB)
1. Launch two instances on AWS Management Console, labelled Instance A and Instance B. Then, go to the Services tab.
2. Select create load balancer.
3. Choose the Application Load Balancer option and click on the “Create” button.
4. Configure the load balancer by providing the name and then choosing the scheme as “internet facing”.
5. Add a minimum of two availability zones. Then Select “us-east-1a” and “us-east-1b”.
6. On the next window, select “Next: Configure Security Groups” to proceed.
7. From the list of Security groups, select “default and move on to “Next: Configure Routing”
8. Select the target group name as “my-target-group” and move on to “Next: Register Targets”.
9. Select the instances A and B and click “Add to registered”. Move on to “Next: Review”.
10. Before clicking on “Create”, review all the configurations thoroughly.
11. The load balancer has been successfully created!