Welcome to Day 52 of the #100DaysOfDevOps Challenge! Today we will cover the AWS ELB - Elastic Load Balancing.
What is Load Balancing?
Load balancing is a technique that distributes network or application traffic across several servers. This can improve performance, reliability, and availability.
Load balancers work by receiving requests from clients and then routing them to one of the servers in the pool. The load balancer uses a variety of factors to determine which server to send a request to, such as the server’s load, availability, and health.
In Amazon EC2, Elastic Load Balancing (ELB) is the load balancing service provided by AWS.
Elastic Load Balancing
Elastic Load Balancing automatically distributes your incoming traffic across multiple targets, such as EC2 instances, containers, and IP addresses, in one or more Availability Zones.
It monitors the health of its registered targets, and routes traffic only to the healthy targets.
Elastic Load Balancing scales your load balancer capacity automatically in response to changes in incoming traffic.
How does Elastic Load Balancing work?
Clients make requests to your application.
The listeners in your load balancer receive requests matching the protocol and port that you configure.
The receiving listener evaluates the incoming request against the rules you specify, and if applicable, routes the request to the appropriate target group. You can use an HTTPS listener to offload the work of TLS encryption and decryption to your load balancer.
Healthy targets in one or more target groups receive traffic based on the load-balancing algorithm, and the routing rules you specify in the listener.
The benefits of load balancing:
Improved performance: Load balancing can improve performance by distributing traffic across multiple servers. This can help to reduce latency and improve response times.
Increased reliability: Load balancing can increase reliability by ensuring that no single server is overloaded. If one server goes down, the load balancer can redirect traffic to the remaining servers.
Improved availability: Load balancing can improve availability by ensuring that your applications are always available. If one server goes down, the load balancer can redirect traffic to the remaining servers.
ELB can be created, accessed, and managed by using AWS Management Console, AWS Command Line Interface, AWS SDKs, and Query API.
Elastic Load Balancing supports the following types of load balancers:
Application Load Balancers
Network Load Balancers
Gateway Load Balancers
Classic Load Balancers
There is a key difference in how the load balancer types are configured:
With Application Load Balancers, Network Load Balancers, and Gateway Load Balancers, you register targets in target groups, and route traffic to the target groups.
With Classic Load Balancers, you register instances with the load balancer.
Cross-zone load balancing
The nodes for your load balancer distribute requests from clients to registered targets.
When cross-zone load balancing is enabled, each load balancer node distributes traffic across the registered targets in all enabled Availability Zones.
When cross-zone load balancing is disabled, each load balancer node distributes traffic only across the registered targets in its Availability Zone.
With Application Load Balancers, cross-zone load balancing is always enabled at the load balancer level.
At the target group level, cross-zone load balancing can be disabled.
With Network Load Balancers and Gateway Load Balancers, cross-zone load balancing is disabled by default. After you create the load balancer, you can enable or disable cross-zone load balancing at any time.
When you create a Classic Load Balancer, the default for cross-zone load balancing depends on how you create the load balancer. With the API or CLI, cross-zone load balancing is disabled by default. With the AWS Management Console, the option to enable cross-zone load balancing is selected by default.
Now let us understand the different types of ELB provided by AWS:
Application Load Balancer
Here is the official documentation of the Application Load Balancer.
ALB Functions at the application layer, the seventh layer of the Open Systems Interconnection (OSI) model.
It intelligently distributes incoming HTTP and HTTPS traffic to target instances, containers, or IP addresses based on the rules and configurations set by the user.
Network Load Balancer
Here is the official documentation of the Network Load Balancer.
NLB functions at the fourth layer of the Open Systems Interconnection (OSI) model. It can handle millions of requests per second.
NLB operates at the transport layer (Layer 4) of the OSI model and is designed to handle TCP, UDP, and TLS traffic.
It is highly scalable, offers low latency, and is suitable for applications that require high performance and extreme scalability.
Gateway Load Balancer
Here is the official documentation of the Gateway Load Balancer.
A Gateway Load Balancer operates at the third layer of the Open Systems Interconnection (OSI) model, the network layer.
It listens for all IP packets across all ports and forwards traffic to the target group that’s specified in the listener rule.
It maintains the stickiness of flows to a specific target appliance using a 5-tuple (for TCP/UDP flows) or 3-tuple (for non-TCP/UDP flows).
Classic Load Balancer
Here is the official documentation of the Classic Load Balancer.
CLB operates at both the application layer (Layer 7) and transport layer (Layer 4) of the OSI model and is ideal for applications that require basic load-balancing features.
CLB provides basic load-balancing capabilities for distributing incoming traffic across multiple Amazon EC2 instances.
Here is the link which gives the product differentiation and pricing of the different ELBs provided by AWS.