Open In App

What Are AWS Load Balancer Types ?

Last Updated : 06 Feb, 2024
Improve
Improve
Like Article
Like
Save
Share
Report

Managing and allocating incoming network traffic is a critical component in the dynamic realm of cloud computing that helps to guarantee high availability and dependability for online applications. Load balancers from Amazon Web Services (AWS) offer a reliable solution. It’s critical to comprehend load balancers if you’re new to using AWS. The practice of load balancing divides incoming traffic among several servers or applications to maximize scalability, availability, and performance. AWS provides many load balancer types to meet various circumstances and demands. We will explore the idea of AWS load balancers in this post, going over terms, detailed procedures, diagrams, and examples to help you understand the basics.

What Is A Load Balancer?

Anything that serves as a middleman between clients and servers or applications is called a load balancer. Requests are received from clients and sent to one or more registered targets, such as AWS Lambda functions, EC2 instances, or containers. To guarantee that it only directs traffic to available and in good-health targets, the Elastic load balancer also keeps an eye on the targets’ performance and health. The load balancer enhances the system’s efficiency, security, and dependability in this way.

Defining Key Terminologies

Before we dive into AWS load balancers, let’s familiarize ourselves with some essential terms:

  • Load Balancing: The process of distributing incoming network traffic across multiple servers to ensure no single server is overwhelmed.
  • Elastic Load Balancer (ELB): AWS’s load balancing service that automatically distributes incoming application traffic across multiple Amazon EC2 instances.
  • Availability Zones: Distinct locations within an AWS region that are engineered to be isolated from failures in other Availability Zones.

How Does A Load Balancer Work?

A load balancer operates by following the steps below:

  • A certain port and protocol, such as HTTP, HTTPS, TCP, or UDP, are used by the load balancer to receive inbound traffic from clients. We refer to this as a listener.
  • Using a routing algorithm—such as round robin, least connections, or source IP hash—the load balancer chooses a target from a list of registered targets. We refer to this as a target group.
  • The load balancer passes the request to the chosen target after connecting to it on a particular port and protocol. After answering the request, the target returns the response to the load balancer.
  • The response is returned to the client by the load balancer.

Types Of Load Balancers In AWS

Application Load Balancer (ALB)

ALB, or application load balancer: An ALB is designed to handle HTTP and HTTPS traffic at the application layer (Layer 7). Requests can be routed according to their content, including query parameters, host headers, and URL paths. Advanced capabilities including HTTP header manipulation, WebSockets, HTTP/2, gRPC, path-based, host-based, and content-based routing are also supported. APIs, microservices, and web applications may all be load-balanced with an ALB.
AWS-load-balancers

Advantages Of Using Application Load Balancer

There are several advantages to using an Application Load Balancer over a Classic Load Balancer.

  • There is support for path conditions. Rules that route requests based on the URL in the request can be set up for your listener. By doing this, you may divide up your application into smaller services and use the content of the URL to determine which service should get requests.
  • Provides support for host conditions. Rules that route requests depending on the host field in the HTTP header may be set up for your listener. This lets you use a single load balancer to redirect requests to many domains.
  • Allow routing depending on request information, including source IP addresses, query parameters, HTTP header conditions, and methods.
  • Ability to route requests to several apps using a single EC2 server. An instance or IP address can be registered on several ports with various target groups.
  • Allow requests to be redirected from one URL to another.
  • Allowing a customized HTTP response to be returned.
  • Enables targets outside of the load balancer’s Amazon VPC to be registered by IP address.
  • Allow Lambda functions to be registered as targets.
  • Allow your load balancer to verify users of your apps using their social or business identities before rerouting queries.
  • Support for containerized apps. When scheduling a job, Amazon Elastic Container Service (Amazon ECS) can choose an idle port and use it to register the task with a target group. You can use your clusters more effectively as a result.
  • Support for tracking each service’s health separately, as many CloudWatch metrics are reported at the target group level, and health checks are specified at that level. By joining a target group to an AWS auto-scaling group, you may dynamically scale each service according to demand.
  • Access logs are compressed files that include extra information.
  • Increased load balancer performance.

Network Load Balancer (NLB)

At the transport layer (Layer 4), NLBs are made to manage TCP, UDP, and TLS traffic. It can process millions of requests per second at a high throughput and low latency. Long-lasting TCP connections, source IP preservation, elastic IP addresses, and static IP addresses are among the capabilities it also provides. Network-intensive applications like gaming, streaming, and voice-over IP (VoIP) may be load-balanced with an NLB.

Advantages Of Network Load Balancer

Using a Network Load Balancer instead of a Classic Load Balancer has the following benefits:

  • Capable of managing erratic workloads and expanding to millions of requests per second.
  • Allow the load balancer to use static IP addresses. One Elastic IP address can also be assigned to each subnet when the load balancer is activated.
  • Support for IP address-based target registration, including support for targets outside the load balancer’s virtual private cloud.
  • Ability to route requests to several apps using a single EC2 server. Multiple ports can be used to register each instance or IP address with the same target group.
  • Support for containerized apps. When scheduling a job, Amazon Elastic Container Service (Amazon ECS) can choose an idle port and use it to register the task with a target group. You can use your clusters more effectively as a result.
  • Support for tracking each service’s health separately, as many Amazon CloudWatch metrics are reported at the target group level, and health checks are specified at that level. By joining a target group to an auto-scaling group, you may dynamically scale each service according to demand.

Gateway Load Balancer (GLB)

With the help of gateway load balancers, you can install, grow, and control virtual appliances including intrusion detection and prevention systems, firewalls, and deep packet inspection machines. It divides traffic while growing your virtual appliances with demand, utilizing a transparent network gateway—a single point of entrance and departure for all traffic.

A Gateway Load Balancer functions at the network layer, the third tier of the Open Systems Interconnection (OSI) paradigm. The listener rule specifies the target group to which traffic is sent after it scans all ports for IP packets. With the use of 3-tuples (for non-TCP/UDP flows) or 5-tuples (for TCP/UDP flows), it keeps flows sticky to a particular target appliance.

Classic Load Balancer (CLB)

In AWS, a CLB is the most traditional kind of load balancer. It can manage transport layer and application-layer HTTP, HTTPS, and TCP traffic. Basic functions including cross-zone load balancing, sticky sessions, and health checks are supported. The more sophisticated capabilities of the other kinds of load balancers, such as web sockets, content-based routing, and HTTP header modification, are not supported by it. Simple load-balancing applications that don’t need the functionalities of other load-balancer types can be handled by a CLB. Incoming application traffic is split up across many EC2 instances in various Availability Zones by a load balancer. Your applications’ fault tolerance will rise as a result. Traffic is only sent to healthy instances when Elastic Load Balancing identifies unhealthy ones.

Classic-Load-balancer

Benefits Of LoadBalancers

  • Using a Classic Load Balancer instead of an Application Load Balancer has the following benefits:
  • Support for TCP and SSL listeners
  • Support for sticky sessions using application-generated cookies

Type

Layer

Protocol

Routing

Features

Use Cases

Classic Load Balancer

4

TCP, HTTP, HTTPS

IP and port

Health checks, SSL/TLS termination, sticky sessions, cross-zone load balancing

Simple load balancing of HTTP/HTTPS or TCP traffic

Application Load Balancer

7

HTTP, HTTPS, WebSocket

Path, host, header, query, method

Health checks, SSL/TLS termination, sticky sessions, cross-zone load balancing, content-based routing, HTTP/2, WebSocket, Lambda functions, authentication, redirect, rewrite

Advanced load balancing of HTTP/HTTPS or WebSocket traffic, microservices, container-based applications

Network Load Balancer

4

TCP, TLS, UDP, TCP_UDP

IP and port

Health checks, SSL/TLS termination, cross-zone load balancing, static IP, elastic IP, preserve source IP, proxy protocol

High-performance load balancing of TCP, TLS, UDP, or TCP_UDP traffic, extremely low latency, static or elastic IP addresses

Gateway Load Balancer

3

Any

GRE

Health checks, cross-zone load balancing, static IP, elastic IP, preserve source IP, proxy protocol, network appliances

Load balancing of network traffic to and from virtual appliances, such as firewalls, intrusion detection and prevention systems, or deep packet inspection systems

Step-By-Step Process Of Creating Load Balancer

  • Log in to the AWS Management Console.
  • Navigate to the EC2 Dashboard and select “Load Balancers.”
  • Click “Create Load Balancer” and choose “Application Load Balancer/Network Load Balancer”
  • Follow the wizard to configure security settings, target groups, and routing.

Examples

You have a front-end and a back-end for your online application. While the back end manages dynamic requests like database queries and business logic, the front end offers static content like HTML, CSS, and JavaScript files. To load balance traffic between the front end and back end, you should employ an ALB. To route requests to various target groups according to the URL path, you should also utilize path-based routing. For instance, the front-end target group should get requests with the route /static/*, while the back-end target group should receive requests with the path /API/*. To do this, you must complete the following:

  • Create an ALB and configure a listener on port 80 for HTTP traffic.
  • Create two target groups, one for the front end and one for the back end, and register the EC2 instances or containers that run the front end and the back-end applications in the respective target groups.
  • Create two rules for the listener, one for the path /static/* and one for the path /API/*, and associate each rule with the corresponding target group.
  • Test the ALB by sending requests to the ALB’s DNS name and verifying that the requests are routed to the correct target group.

Conclusion

We have covered the definition of load balancers, their operation, and the primary varieties available in AWS in this blog article. For your benefit, we have also included some examples and FAQs to assist you in better comprehending the subject. Beginners may successfully traverse the world of AWS load balancing by learning about the kinds, terminology, and step-by-step methods.

AWS Load Balancers – FAQs

How Do I Choose The Right Type Of Load Balancer For My Application?

The protocol, performance, and functionality your application needs will determine which load balancer type to choose. If your application utilizes HTTP or HTTPS, you should use an ALB; if it uses TCP, UDP, or TLS, you should use an NLB; if it requires network and security services, you should use a GLB; and if it doesn’t need the functionality of the other types of load balancers, you should use a CLB.

How Do I Monitor And Troubleshoot My Load Balancer?

You can use various tools and methods to monitor and troubleshoot your load balancers, such as CloudWatch metrics, CloudWatch alarms, access logs, health checks, and VPC Flow Logs. For more information, see the Monitoring your load balancer section in the AWS documentation.

How Do I Secure My Load Balancer?

Security groups, network ACLs, SSL/TLS certificates, HTTPS listeners, AWS WAF, AWS Shield, and AWS Firewall Manager are just a few techniques you might use to safeguard your load balancer. See the AWS documentation’s Security for your load balancer section for further details.

How Do I Scale My Load Balancer?

You can scale your load balancer by adding or removing targets, enabling or disabling Availability Zones, adjusting the target group attributes, or using Auto Scaling groups. For more information, see the Scaling your load balancer section in the AWS documentation.

Can I Use An ALB For Handling Non-HTTP/HTTPS Traffic?

No, ALB is specifically designed for HTTP/HTTPS traffic. For other protocols, consider using NLB or CLB.

What Is The Advantage Of Using Network Load Balancer?

NLB is designed for extreme performance and low-latency scenarios, making it suitable for applications with high demand for real-time data.

Are There Any Additional Costs Associated With Using AWS Load Balancers?

Yes, there are costs associated with data transfer, provisioned capacity, and additional features. Refer to the AWS pricing documentation for detailed information.

Can I Distribute Traffic Across Multiple Regions Using AWS Load Balancers?

No, AWS Load Balancers operate within a single region. For global load balancing, consider using AWS Global Accelerator.



Similar Reads

What is Load Balancer & How Load Balancing works?
Load Balancer is defined as a networking device or software application that distributes and balances the incoming traffic among the servers to provide high availability, efficient utilization of servers, and high performance. A load balancer works as a “traffic cop” sitting in front of your server and routing client requests across all servers. It
10 min read
Elastic Load Balancer in AWS
In simplest terms, cloud computing means storing and accessing the data and programs on remote servers that are hosted on the internet instead of the computer’s hard drive or local server. It is also referred to as Internet-based computing. What are Amazon Web Services?Amazon Web Services is a subsidiary of Amazon.com that provides on-demand cloud
5 min read
AWS Load Balancer Pricing | Analyzing the Cost and Benefits
The AWS Load Balancer, a pivotal component of Amazon Web Services is a vital infrastructure, that plays a vital role in managing web traffic efficiently and ensuring high availability and fault tolerance. As businesses increasingly rely on AWS for their cloud computing needs, knowing the cost dynamics associated with the AWS Load Balancer becomes c
9 min read
AWS Application Load Balancer
The application load balancer distributes incoming HTTP and HTTPS traffic across multiple targets such as Amazon EC2 Instances, microservices, and containers, based on request attributes. When the load balancer receives a connection request, it evaluates the Listener rules in priority order to determine which rule to apply, and if applicable, it se
14 min read
How To Integrate AWS Auto Scaling With Application Load Balancer?
On learning how to bring efficiency to your AWS infrastructure will enhance the workflow and cost management. In this article, we will guide you on integrating AWS Auto Scaling and Application Load Balancer. Exploring the seamless setup process, empowering your applications to effortlessly scale based on demand. Enhancing your cloud architecture fo
7 min read
How To Integrate AWS Auto Scaling With Classical Load Balancer ?
Auto Scaling is a service in Amazon Web Services (AWS) with the help of an EC2 instance that automatically changes the number of instances as per the user's application demand. this nature of auto-scaling helps to achieve high availability for an application without any high cost. The elasticity feature of auto-scaling allows users to scale up and
5 min read
AWS Application Load Balancer Using Terraform
In contemporary cloud infrastructure setups, managing and distributing incoming traffic effectively across various instances is central to ensuring the high accessibility and scalability of applications. Among the bunch of services given by AWS (Amazon Web Services), Elastic Load Balancing (ELB) stands apart as a basic part of working with this tas
10 min read
How To Configure GateWay Load Balancer In AWS ?
In the advanced landscape of cloud computing, managing incoming internet traffic efficiently is fundamental for ensuring the accessibility, scalability, and reliability of applications. AWS offers a set of services to address these necessities, and one such help is the Gateway Load Balancer (GWLB). Gateway Load Balancer is an incredible tool intend
7 min read
AWS Elastic Load Balancer Health Check
In the domain of cloud computing and web application hosting, ensuring the persistent accessibility and execution of services is vital. Elastic Load Balancing (ELB) is a major help given by Amazon Web Services (AWS) that assumes a vital part in accomplishing high accessibility, adaptation to internal failure, and versatility for applications convey
8 min read
Create and Configure: Mastering AWS Network Load Balancer Essentials
In the domain of distributed computing, compelling administration of network traffic is fundamental for keeping up with the presentation, dependability, and versatility of utilizations. Amazon Web Services (AWS), a main cloud specialist organization, offers the Network Load Balancer (NLB) as an essential device for accomplishing these goals. NLB fi
8 min read