AWS ELB is a load balancing service provided by Amazon to distribute the network incoming traffic across different EC2, Lambda automatically. It also helps to scale resources behind load balancer to meet high incoming traffic. Having said that, if your web application containing an Ec2 only. Then as your business grows, more traffic would hit to your application and the single instance would not be able to handle that much of load. Having multiple instances across your ELB, the load balancer to distribute the incoming traffic to the most healthy instances at that time. So ELB provides below advance features
- Distribute incoming traffic to Healthy Instance
- Health Check of the EC2 on a periodic basic
- Detect Unhealthy Instance
- Supports both IPv4 and IPv6
- Public Key Authentication
- Centralized Management of SSL Certificates
Amazon VPC allows you to assign a security group to your ELB. You could use either default SG within your VPC or could create a new one to better manage your firewall for your infrastructure. You could also route traffic through an ELB using private IP.
AWS auto scaling could be integrated with ELB. So that required EC2 could be up and running behind your ELB during high traffic. You are all set, once you configure the auto scaling in your infrastructure and no manual intervention would be required after that. You could add different conditions to your auto scaling group to support all kind of traffic
AWS ELB provides high availability to your application. It periodically connect with your backend EC2 and measure the health check and send the incoming traffic to the most healthy instance. That means when an instance is unhealthy or not reachable then it sends traffic to the other instance. For best use case, you could spin up your instances across different availability zones. So that if there is an issue with one AZ, then the instance in other AZ could respond and would minimize the downtime of your application.
Types of Load Balancers
As of today, AWS provides three types of load balancing for scalable cloud computing and advanced traffic routing.
Classic Load Balancer (CLB)
This is a previous generation load balancer designed for EC2-Classic network. This distributes incoming traffic to multiple instances hosted in same or different availability zone to met your application need. This increases the fault tolerance for your architecture. It acts as a single point of contact for your client. When the request comes from client, it tries to evenly distribute the request across different Availability Zones. It supports
- EC2 Classic
- HTTP, TCP and SSL listeners.
Application Load Balancer (ALB)
This is mainly used for web applications for HTTP & HTTPs traffic. This ELB receives the traffic from client and provides advanced routing at application architecture. You could add one or more listeners to your ELB. Each listeners could be configured with its port and protocol. ALB supports below
- It helps in redirecting request from one URL to another
- Custom http response could be returned
- It supports Lambda function
- Support both host-based and path-based routing
- It supports Containerized application
- Better Performance
- Better logs management
- It provides user level authentication
The host-based routing is more useful when your web application pointing to two different web address has been hosted on two EC2 instances for high availability. You could distribute the traffic between them using a single Application Load Balancer.
With path-based routing you could also use the single ALB to distribute the incoming traffic to different path of your application. It could be your direct application URL like http://www.yourapp.com and other path like reports (www. yourapp .com/reports)
Network Load Balancer (NLB)
As the name suggests, Network Load Balancer operates at the network layer of Open System Interconnections (OSI) model. This LB is useful when there is sudden increase in your application traffic. This works on connection level to better handle the spike of your traffic when your business grows. It works better for both TCP and UDP connections. It supports
- It supports sudden spike in your incoming traffic
- Better for handling huge incoming request
- Support routing to multiple applications on a single EC2
- Better Health Check
- Supports Containerized service
I hope this blog helps to understand basic about AWS Elastic Load Balancer. Please comment below if you have any questions related to this post.