Elastic Load Balancer (ELB)

Elastic Load Balancer (ELB)

ยท

4 min read

In this blog we are going to discuss ELB i.e. Elastic Load Balancer.

Whenever we want to build a cluster of services, We have Multiple Server, Let say multiple web server. We need a single endpoint to access them and that mostly provided through a load balancer.

If we are using AWS, we don't need to build our own load balancer. Like if we are using Nginx or HAproxy or something like that for load balancing, we can ditch that and can very easily use elastic load balancer.

  • If we are aware about the ports of the load balancer, the frontend port and the backend port, then we can very easily use this load balancer

Frontend port for load balancer

The load balancer will have a frontend port that's where it's going to listen Like we access google.com on port 443. Generally https default port 443. So, if we are hosting a web service for Https connection we will be giving frontend port as 443 to our load balancer.

Backend Port for Load balancer

There are Backend port for the load balancer, Backend ports are based on the service port number that is running on the backend servers. So on the back end if we are running, Let's say Tomcat server which are running on port 8080 then the load balancer backend port will be 8080.

AWS elastic load balancer is going to receive the traffic and distributed on the backend on multiple targets. These Targets mostly will be ec2 instances, but we can have containers, we can have other IP addresses which are distributed in multiple availability zones. So we can have a cluster that is in multi zones and the load balancer will be an endpoint for that.

Types of Elastic Load Balancer

Elastic Load Balancing supports three types of load balancers:

  1. Application Load Balancer
  2. Network Load Balancer
  3. Classic Load Balancer

Classic Load Balancer

  • Classic Load Balance is the simplest load balancer. I just basically accept incoming traffic and distribute it to our backend servers and this works at network layer of Our OSI model

  • Classic load balancer is really ideal for simple load balancing where we do not need other complications.

  • We create a classic load balancer, user access this load balancer and that is going to forward the request to backend ec2 instance.

  • For example there is 2 ec2 instance the 1st request goes to 1st instance, 2nd goes to second instance.

We can have as many as ec2 instance distributed in multiple availability zones.

Application Load Balancer.

  • This load balancer is very popular for the web traffic, like the websites, apps http & https protocol basically

  • This is a layer 7 load balancer and that means it really fits in the OSI layer 7 that means it's not just going to route the traffic based on the port number, the network layer but at the application layer. So if the user is accessing gautamjha.hashnode.dev and user is saying gautamjha.hashnode.dev/ebs-elastic-block-storage, it can route the traffic on separate cluster of server or ec2 instance. and if user is saying gautamjha.hashnode.dev/getting-started-with-aws, it can route the traffic to different cluster of ec2 instances.

This is Application load balancer only used for HTTP & HTTPS

Network Load Balancer

  • Network load balancer comes at the fourth layer in OSI model.
  • It can handle millions of requests per second.
  • If we need a load balancer which can handle millions of request for our millions of user for our websites or web applications then we should go with network load balancer.
  • This load balancer can connect with static IP.

Application and classic load balancer we get an endpoint and that endpoint will translate to an IP address. But these IP change , these are dynamic IP, But we can create an elastic IP and attach to a network load balancer. so our network network load balancer has static IP then.

Now we also have gateway load balancer which is to manage our virtual appliances like firewalls.

Thank You for Reading ๐Ÿ˜Š๐Ÿ˜Š Have a Great Day!

Did you find this article valuable?

Support Gautam Jha by becoming a sponsor. Any amount is appreciated!

ย