Elastic Load Balancer
- Elastic Load Balancing automatically distributes your incoming application traffic across multiple targets, such as EC2 instances
- It monitors the health of registered targets and routes traffic only to the healthy targets.
- Load Balancer are servers that forward internet traffic to multiple servers.
Benefits of Load Balancer
Using load balancer on top of the application provides various advantages:
- Spreads Load: Spreads load across multiple targets.
- Single point DNS: Single point entry for DNS. So exposes only one Public IP.
- High availability: Provides High Availability (HA).
- Health checks: Helps with Health Checks at particular time interval so it knows when not to send traffic to particular instances. Health checks enable LB to know if instance it forwards traffic to are available for responding to user requests or not.
- AWS managed: Elastic load balancer is managed load balancer by AWS.
Types of load balancer in AWS
AWS Elastic Load Balancer comes with 4 types of load balancer viz;
- Classic Load Balancer (CLB):
- This is one of the oldest type of load balancer which originated in year 2009
- Classic Load Balancer functions at the 4th and 7th layer of the OSI model.
- Health checks can be applied at TCP or HTTP.
- Single hostname is available due to LB
- Application Load Balancer (ALB):
- An Application Load Balancer functions at the application layer, the 7th layer of the OSI model.
- It allows you to route to multiple HTTP applications across machines (i.e. Target Groups).
- It also allows to load balance multiple applications on the same machine (i.e. Containers).
- Each target group is used to route requests to one or more registered targets.
Routing to ALB is based on Target Groups:
- Routing based on the ‘Path’ in URL
- Routing based on ‘Hostname’ in URL
- Routing based on ‘Query strings’ (For dynamic websites using DB at backend). As compared to CLB, we need to configure multiple CLB for multiple applications. But on ALB we can use one LB to multiple applications.
abc.com/test, abc.com/ users etc.
one.abc.com, two.abc.com etc.
- A Network Load Balancer functions at the 4th layer of the Open Systems Interconnection (OSI) model.
- It can handle millions of requests per second.
- Gateway Load Balancers enable you to deploy, scale, and manage virtual appliances, such as firewalls, intrusion detection and prevention systems (IDP), and deep packet inspection systems.