DEV Community

Cover image for Load Balancer in AWS(ELB)
Ajit Singh for This is Learning

Posted on • Edited on

Load Balancer in AWS(ELB)

We need multiple instances of a server so if one of them shuts down because of any hardware failures or load the other can handle the load and we don't experience down times but if we setup multiple instances how to manage which server will handle the requests and at what time. This is where AWS load balancers ELB(Elastic Load Balancer) comes in.

What are load balancers?

These are basically servers that point and forward the incoming traffic to multiple different servers in a streamlined fashion.

Why load balancers?

  • It provides a way to scale your application
  • It reduces downtime by maintaining health checks on different instances.
  • It provides single point of access to multiple servers.
  • We can provide a single configuration point for things like HTTPS, DDoS attacks etc

Advantages of using Amazon ELB

We can always setup our own load balancers and will be cheap as compared to ELB. So, why should we use them we should just get an Ec2 instances and setup our own load balancer on it. Setting up our load balancer comes with cost saving with respect to the service but it has its problems with managing the load balancer. You have to ensure how to update configure and maintain it. Which may be a full time jib if you have 3-4 load balancers setup and setting up more will a hassle each time. With this service AWS ensures that they will upgrade, maintain with you only have to setup a few configuration knobs.

There are two type of load balancers available in AWS:-

  1. Network load balancer (Layer 4)
  2. Application Load balancer(Layer 7)

Network load balancer

Network load balancing uses information defined at the networking transport layer (Layer 4) as the basis for deciding how to distribute client requests across a group of servers. A network load balancer does load-balancing based on on the source and destination IP addresses and ports recorded in the packet header, without considering the contents of the packet.

Application load balancer

Application load balancer deals with the actual content of each message. HTTP is the predominant Layer 7 protocol for website traffic on the Internet. Application load balancers route network traffic in a much more sophisticated way than Network load balancers, particularly applicable to TCP‑based traffic such as HTTP. An application load balancer terminates the network traffic and reads the message within. It can make a load‑balancing decision based on the content of the message (the URL or cookie, for example). It then makes a new TCP connection to the selected upstream server (or reuses an existing one, by means of HTTP keepalives) and writes the request to the server.

To know more about the layers in internet you can look up OSI reference model

In the next article we will see how to setup a ELB with AWS.

Top comments (0)