Elastic Load Balancer (ELB) automatically distributes your all incoming application traffic across multiple targets, such as multiple EC2 instances. ELB monitors the health of registered targets and routes traffic only to the healthy targets.

Note: ELB is not a standalone service, while it is a part of your EC2 Service. So you can find an Elastic Load balancer from EC2 Dashboard.

ELB supports three types of load balancers these are as below:

  • Application Load Balancers
  • Network Load Balancers
  • Classic Load Balancers.


The load balancer serves as a single point of contact for clients, which increases the availability of our application. We can add and remove instances from our load balancer as per our needs change, without disrupting the overall flow of requests to our application.

Elastic Load Balancer (ELB) scales your load balancer as traffic to your app changes over the period of time, and can scale to the extensive majority of workloads automatically.

Architecture of Elastic Load Balancer(ELB)


Features of Elastic Load Balancing:-

  1. High Availability
    ELB automatically distributes traffic across multiple targets – Amazon EC2 instances, containers and IP addresses – in a single Availability Zone or multiple Availability Zones as per need.
  2. Health Checks
    ELB can automatically detect unhealthy targets, stop sending traffic to them, and then send the load across the remaining healthy targets so that request and response model should not impact due to unhealthy instance.
  3. Security Features
    Use Amazon Virtual Private Cloud (VPC) to create and manage security groups associated with load balancers to provide additional networking and security options. We can also create an internal (non-internet-facing) load balancer too.
  4. Operational Monitoring
    ELB provides very simple integration with Amazon CloudWatch metrics and request tracing in order to monitor performance of your applications in real time with.

Application Load Balancer

An Application Load Balancer functions at the application layer, the seventh layer of the OSI reference model. After the load balancer receives a request, it evaluates all the listener rules in priority order to determine basically which rule needs to apply, and then selects the target from the target group for the rule action using the round robin algorithm.

Note that you can also configure the listener rules to route your requests to different target groups based on the content of the application traffic.Routing is performed independently for every target group, even when a target is registered with multiple target groups too.

We can configure health checks, which are used to monitor the health of the registered targets so that the load balancer can send our requests only to the healthy targets.

The following diagram shows the basic components. Notice that every listener contains a default rule, and one listener contains another rule that routes requests to a different target group.


Steps to create Application Load Balancer:

Step 1: Choose Application Load Balancer.


Step 2: Configure your load balancer.


Step 3: Add Listener to your load balancer.


Step 4: Go to Configure security group and ignore the warning.


Step 5: Now create a security Group.


Step 6: Create Target group


Step 7: Adding instances to your load balancer


Step 8: Review and create ELB.


Network Load Balancer:

A Network Load Balancer (NLB) functions at the fourth layer of the OSI reference model. The load balancer distributes all incoming traffic across multiple targets, like EC2 instances. Network Load Balancer (NLB) can handle millions of requests per second. After the load balancer receives a connection, it selects a target from the target group for the default rule using a flow based on hash routing algorithm.

NLB attempts to open a TCP connection to the selected target on the port specified in the listener configuration.

NLB forwards all requests without modifying the headers.


Benefits of Network Load Balancer as below:

  1. Ability to handle high workloads and scale to millions of requests per second.
  2. NLB support for fixed IP addresses for the load balancer. We can assign one Elastic IP address per subnet enabled for the load balancer.
  3. NLB supports routing requests to multiple services on a single EC2 instance by registering the instance using multiple ports.
  4. NLB supports containerized applications. Amazon EC2 Container Service (ECS) can select an unused port when scheduling a task and register the task with a target group using this port. It enables you to make efficient use of your clusters.
  5. NLB supports monitoring the health of each service independently, as health checks are defined at the target group level and many CloudWatch metrics are reported at the target group level.

Steps to create Network Load Balancer:

Step 1: We can create a NLB opening up the EC2 Console, selecting Load Balancers, and clicking on Create Load balancer and from there choose Network Load Balancer.


Step 2: Configure Load Balancer by selecting VPC and subnets.


Step 3: Creating target group and health check


Step 4: Register instance as target and click Next.


Step 5: Review your Load balancer and click on create.


Classic Load Balancer:

The Classic Load Balancer (CLB) operates at Layer 4 of the OSI reference model. This means that the load balancer routes traffic between clients and backend servers based on IP address and TCP port.

For example, CLB at a given IP address receives a request from a client on TCP port 80 i.e HTTP

Benefits of Classic Load Balancer

  1. Using a Classic Load Balancer instead of an Application Load Balancer has the following advantages:
  2. CLB supports TCP and SSL listeners
  3. CLB supports sticky sessions using application-generated cookies.

Steps to create Classic Load balancer.

Step 1: Click over Create to create a classic load balancer.


Step 2: Give the desired name to your Load balancer


Step 3: Create a new security group and click on Next.


Step 4: Click on Next to configure the health check.


Step 5: Choose ping protocol as TCP and apart from that you can provide the value to Advance Detailed Section. Here based on the provided numeric value it will decide whether which instance is healthy and which is unhealthy. In our demo purpose we are taking values as below:

Response Timeout : 5 Second
— Wait for getting response for 5 Second.
Interval: 30 Second
— After every 30 Second, it will send a health check request to the attached instance.
Unhealthy Threshold: 2
— If continuously, 2 times, it will not get response then it will declare that instance as unhealthy.
Healthy Threshold: 10 Second
— If continuously 10 times, it will get response then it will declare that instance as healthy.


Step 6: Adding EC2 instances with Load Balancer. Click on Next

Step 7: Create Tags as below. Which means providing the name to your Load Balancer.


Step 8: At last review your Load Balancer configuration and then create your load balancer.

Subscribe Now