Understanding AWS Elastic Load Balancer

Imagine having an application running on a single AWS instance which starts to receive more traffic than it can already handle. A sudden spike in traffic can increase the overall burden on your application instance. As a result, your instance may fail and the application will eventually stop running. This is where AWS Elastic Load Balancer comes to the rescue. 

Before I get into talking about Elastic Load Balancers, I assume you already have basic networking knowledge, AWS EC2, Cloud Computing and how load balancing works. 

Read:

What is an Elastic Load Balancer?

One of the key services that Amazon Web Services provide is the AWS Elastic Load Balancer. 

It is a load balancing service that allows the distribution of incoming traffic across multiple instances or targets such as Amazon EC2 instances, IP addresses, containers, and even Lambda functions. 

AWS ELB automatically scales. This means that you can have multiple instances added on the fly. And route incoming traffic across all of them in various availability zones. 

It also provides strong security essentials to make your applications fault-tolerant on the AWS cloud environment.  

A load balancer sits between the requesting devices and the nodes that provide the services of your application.  

Elastic Load Balancers

So, instead of making direct HTTP or HTTPs requests to an EC2 instance, the users of your application will make requests to the address of the elastic load balancer.

The load balancer then routes requests to its registered targets such as EC2 instances. 

You also need to configure your EC2 security groups to only allow incoming traffic from the load balancer. 

Besides, the load balancer will also have its security group that accepts traffic from the web.

Now your application has a single web address that of the load balancer whereas before it was the EC2 instance. 

Types of AWS Elastic Load Balancers

AWS currently supports three types of load balancers, they are:

  • Application Load Balancer
  • Network Load Balancer
  • Classic Load Balancer

Application Load Balancer

Application Load Balancer is the type of load balancer best for routing HTTP and HTTPS requests from clients.

One of the key features of the Application Load Balancer is that they can listen for these protocols on any port.

ALB also can redirect HTTP to HTTPs to establish a secure connection with the application. Not only that but also they can integrate with AWS Certificate Manager to run secured connections like HTTPS & TLS. 

They operate on the request level which is layer 7 of the OSI model and makes routing decisions depending on the information in the requesting HTTP headers.

You can also set and serve static content such as maintenance notice when your application is offline and going through changes. 

The Application Load Balancer has listeners and rules. The listener on the ALB acknowledges requests when the client makes the request.

On the other hand, the rules are just for specifying the routing of each client request as it gets through the listener. 

As the listener on the ALB acknowledges the requests, you set routing rules to target the collection of hosts known as target groups. 

Think of target groups as the connection between your Elastic Load Balancer and your EC2 Instances. Application Load Balancers can support multiple target groups as well. 

Network Load Balancer

A Network Load Balancer is suitable for load balancing of Transmission Control Protocol (TCP), User Datagram Protocol (UDP) and Transport Layer Security (TLS) traffic.

A Network Load Balancer operates at the fourth layer of the OSI model. So, they are unable to make routing decisions based on the HTTP header information.

Instead, you set the rules on your listener configuration to map traffic from ports to ports.  

After a load balancer receives a client request, it picks a target from the target group and then attempts to open a TCP connection to the selected target’s port which you have to specify in the listener configuration. 

A key feature is that it can handle millions of requests per second. For handling sudden and volatile traffic patterns, a network load balancer is also an ideal solution. 

They support multiple TCP port listeners and can be assigned a static IP address.

They are also able to route requests to multiple ports of a single instance. 

Unlike Application Load Balancer, the Network Load Balancer will only forward request to target groups. It doesn’t analyze the HTTP header information. Where ALB will examine the information of the HTTP request header to determine where to route the client request.

Classic Load Balancer

This is the traditional way of load balancing. In simple terms, a classic load balancer ideal for distributing incoming traffic across multiple EC2 instances in multiple availability zones. 

However, one of the most important distinctions separating classic elastic load balancers and the other two load balancers is the idea of target groups.

If you can recall, then target groups are just the connection between your Elastic Load Balancer and your EC2 Instances.

So, instead of connecting your EC2 instances directly to the ELB, you specify a group of hosts called target groups. 

Classic Load Balancer operates at the fourth layer of the OSI model similar to Network Load Balancers. And Classic Load Balancer also supports HTTP, HTTPS, TCP, SSL.

Here’s a picture from nClouds depicting the key differences between the Elastic Load Balancers:

Elastic Load Balancer

Features of AWS Elastic Load Balancer

Elastic Load Balancers provide useful features such as high availability, health check, elasticity, and security. Here are some of the features in brief:

High availability 

An Application sitting behind an Elastic Load Balancer is distributed across multiple highly available zones.

According to the official website of AWS, ELB can automatically distribute incoming traffic across various targets. These targets can range from EC2 instances, containers, etc hosted across multiple AWS Availability Zones. 

Health Check

ELB constantly monitors the health of each of your associated targets or instances.

If detected targets are unhealthy then Elastic Load Balancer will automatically mark it as OutOfService and stop sending traffic to them.

The ELB will then proceed to distribute the incoming traffic and the load across the targets that are functioning properly. 

Elasticity 

AWS ELB can handle sudden spikes and changes in incoming traffic through the use of Auto Scaling Group.

What it does is, it automatically increases the number of instances associated with the Elastic Load Balancer when the traffic is high. And automatically reduces the number of instances when there is low incoming traffic to an application.

This is one of the ways that ELB provides elasticity by handling different levels of application load without requiring manual interference. 

Security

Security is the most important part when it comes to every application that is out on the cloud.

To make sure that your application on the cloud is well secured, ELB also works with the Amazon Virtual Private Cloud (Amazon VPC).

Amazon VPC offers strong security features, including integrated certificate management, user-authentication, and SSL/TLS decryption and more.

Additionally, you can also create and manage security groups of your load balancers through integrating ELB with Amazon VPC for an extra layer of added security.

Also Read: AWS IAM – Five Best Practices for Security

4 Ways to Access AWS Elastic Load Balancer

  • AWS Management Console— This is a graphical web interface that allows you to access AWS ELB through the AWS console. 
  • AWS Command Line Interface (AWS CLI) — If you have the AWS Command Line Interface installed on your computer then you can access the Elastic Load Balancer along with other sets of AWS services through your command line. The AWS CLI is supported on Windows, macOS, and Linux. Check the AWS Command Line Interface documentation to learn more about the AWS CLI. 
  • AWS SDKs — AWS also provides APIs supporting multiple programming languages. You can utilize various programming languages to interact with AWS services such as ELB. For more see the AWS SDKs.
  • Query API— You can also make HTTPs request to access the Elastic Load Balancers through the use of Query API. 

Conclusion

Any critical application sitting on the AWS cloud environment requires a load balancer.

A load balancer that will automatically distribute traffic across multiple instances in an event of rapid spikes in network traffic.

Thus, the AWS Elastic Load Balancer serves a very good purpose to make sure that your application is fault-tolerant. Moreover, it is always available to serve your users’ needs. 

To learn more about Elastic Load Balancers & AWS, I highly recommend that you should check some of the hands-on training from LinkedIn Learning. 

Here are some courses that may interest you if you want to learn more about AWS & Cloud Computing:

Signing up with LinkedIn Learning is free and you can try out their other courses without any additional charges. 

Elastic Load Balancer

Also, make sure to check out their cloud computing learning path, Become a Cloud Developer

It features 21 hours of training videos and hands-on exercises on how you can become a professional cloud developer. 

What are your thoughts on AWS reinventing the wheel of load balancing?

Leave a Reply