Introduction to AWS Elastic Load Balancer (AWS ELB)
Before we begin with AWS ELB service explanation, we must understand what a Load Balancer is?
Load Balancer is a physical/virtual device used to balance the network load across Web-Servers. Load Balancer could sit inside the DCs for internal Load Balancing but usually are placed facing the internet to balance the load across the Web Servers in the Data-Centers.
AWS Elastic load balancer is a Cloud based Load Balancer Service that helps to distribute the incoming application (Web Server) traffic to different targets i.e. EC2 instances, Containers, Virtual Appliances within the Data Center. AWS Elastic load balancer is capable of distributing the application traffic within a single Availability Zone or across multiple availability zones.
ELB acts a single entry point for the traffic incoming to data center and once the traffic reaches ELB, it then makes some traffic routing decision based on the configured parameters.
In order to access ELB you can use the following methods:
- AWS Management Console
- AWS Command Line
- AWS APIs
Types of AWS Elastic Load Balancer
We have mainly three types of Load Balancers in AWS ELB:
- Classic Load Balancer
- Network Load Balancer
- Application Load Balancer
Classic Load Balancers:
These are generally referred to as Legacy Load Balancers. They can be used to load balance the traffic based on Layer 7 parameters i.e. HTTP/HTTPs and also can work on Layer 4 for the applications that rely on TCP protocol.
A classic load balancer can distribute the traffic to different EC2 instances spread across multiple availability zones only if cross zone load balance is enabled. By default is distributes load only to single availability zone. They also can monitor the health of the targets continuously and based on that can route the traffic only to the healthy applications. Instances monitored by ELB are reported as either InService (Healthy) or OutofService (Unhealthy).
Classical Load Balancer cannot be assigned IP address, hence they have their own DNS name. It also supports sticky sessions where a traffic from a particular user over a session is always directed to a single EC2 instance.
Network Load Balancer:
A network Load Balancer provides load balancing at Layer 4 of OSI model for both TCP/UDP protocols. These type of load balancers are best suited where we the applications are TCP based are require ultra-low latencies. These are capable to handling millions of requests per second.
Network Load Balancers provide support for the static IP address per Availability Zone and this IP can be used as the front-end IP of the load balancer. It can also integrate with other AWS services i.e. Route 53 so when a Network Load Balancer becomes unresponsive, it’s IP address is removed from service and traffic is directed to alternate Load Balancer in another region.
Network Load Balancer has the target groups configured with certain targets defined within each target group. Target within a target group could be an Instance, IP address or a Lambda Function. We then create listener rules with certain conditions and direct the traffic to specified target groups of the condition is met.
Application Load Balancer:
An application load balancer works at the layer 7 of the OSI model which is best suited to load balance the HTTP & HTTPs traffic.
Application load balancers also work with target groups in the same way as network load balancers do i.e. you define a target groups with certain targets and then create a listener rule to direct traffic towards a particular target group.
Application load balancers also support content based routing which means you can distribute your traffic based on the content of the incoming traffic i.e. Host field, Path URL, HTTP header, HTTP method, Query string or Source IP address.