Amazon Elastic Load Balancers
1. Application Load Balancer
What does Application Load Balancer do?
Application Load Balancer helps to provide scale, performance, and resiliency for web applications deployed on the cloud. It distributes incoming traffic to application servers across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, in one or more Availability Zones. Application Load Balancer functions at Layer 7 of the Open Systems Interconnection (OSI) model. Application Load Balancer supports load balancing of application traffic using HTTP and HTTPS (Secure HTTP) protocols, and automatically handles the load based on the incoming traffic pattern.
What problems does Application Load Balancer solve?
Traditional load balancers operate at the transport layer of OSI Layer 4. Because traffic is routed to a destination IP address and port, traditional network load balancers are limited to TCP/IP traffic. They do not support granular application-level traffic control.
Application Load Balancer, however, distributes application traffic to many servers behind it using application-level logic configured by the operator. It uses content-based routing with additional attributes of an HTTP and HTTPS request. And, it can manage more complex routing decisions and provide greater efficiency to handle application traffic at scale.
For example, Application Load Balancer natively supports microservices, container-based, and serverless architectures. And, it can route traffic based on content type and request type. For example, a cloud-based consumer website may have many servers supporting user login and authentication, store branding and images, a product catalog, fulfillment, payment, billing, shipping, and others. Based on each request type, Application Load Balancer can route traffic to different servers, enhancing scale, performance, and resiliency.
The following diagram demonstrates the process an Application Load Balancer follows to complete the requested actions. Once the load balancer receives a request, it evaluates the listener rules in priority order to determine which rule to apply, and then selects a target from the target group for the rule action.
What are the benefits of Application Load Balancer?
Application Load Balancer operates on OSI Layer 7 traffic, and opens up options to manage traffic for better application performance and scale. It helps you to deploy application servers, by routing the traffic for scaling, performance, and cost based on configuration. Content-based routing
Redirection
Transport layer security (TLS) termination
Server name indication (SNI)
Sticky sessions
Integration with AWS Web Application Firewall (AWS WAF)
What are the basic technical concepts of Application Load Balancer?
Routing in Application Load Balancer is performed independently for each target group, even when a target is registered with multiple target groups. Application Load Balancer uses both the round-robin load balancing algorithm and the least-outstanding-requests algorithm. Round-robin is the default routing algorithm, but you can also specify the least-outstanding-requests routing algorithm.
Consider the following concepts:
Listener: A listener on an Application Load Balancer checks for connection requests from clients using the port and protocol and determines how to route requests to registered targets.
Target group: Application Load Balancer routes requests to one or more registered targets (for example, Amazon EC2 instances) using the port and protocol that you configure. Traffic is forwarded to the target group that is specified in the listener rule.
Health check: Application Load Balancer uses health checks to measure the availability of target servers. The Application Load Balancer periodically sends requests to targets to check if they’re classified as healthy.
Availability Zones: These are multiple, isolated locations within an AWS Region. You can increase the fault tolerance of your applications by configuring multiple Availability Zones for Application Load Balancer.
Cross zone: If cross-zone load balancing is turned on, each load balancer node distributes traffic across the registered targets in all configured Availability Zones. If cross-zone load balancing is turned off, each node distributes traffic across the registered targets in its Availability Zone only.
What are typical use cases for Application Load Balancer?
Typical use cases for the Application Load Balancer
Authentication
Websocket
HTTP/2
IP addresses as targets
Lambda functions as targets
Support for gRPC
2. Network Load Balancer
What does Network Load Balancer do?
Network Load Balancer is part of the Elastic Load Balancing (ELB) family. ELB automatically distributes your incoming traffic across multiple targets, such as Amazon Elastic Compute Cloud (EC2) instances, containers, and IP addresses, in one or more Availability Zones. Network Load Balancers monitor the health of their registered targets and route traffic only to the healthy targets. They are optimized to handle sudden and volatile traffic patterns by distributing the incoming traffic to multiple target groups. The target group definition consists of instance IP, port, and protocol in one Availability Zone or more.
Network Load Balancers function at Layer 4 of the Open Systems Interconnection (OSI) model. They are ideal for both TCP and UDP load balancing. Network Load Balancer targets can be Amazon EC2 instances, microservices, containers, Application Load Balancers, or any servers on an on-premises network.
A load balancer serves as the single point of contact for clients. Incoming source traffic arrives from TCP and UDP traffic. You add one or more listeners to your load balancer. A listener checks for connection requests from clients, using the protocol and port that you configure, and forwards requests to a target group. The load balancer distributes incoming traffic across multiple targets, such as Amazon EC2 instances. This increases the availability of your application.
What problems does Network Load Balancer solve?
Network Load Balancer is designed to handle tens of millions of requests per second while maintaining high throughput at ultralow latency, with little or no effort on the customer’s part. There is no need to request pre-provision capacity because a Network Load Balancer can handle millions of requests, even with a cold start or during volatile, spiky traffic.
Over the years, customers have used ELB to support websites and applications that run at almost any scale. This can be from simple sites running on one or two T2 instances to complex applications that run on large fleets of higher-end instances. Such instances handle massive amounts of traffic.
Behind the scenes, ELB monitors traffic and automatically scales to meet demand. This process, which includes a generous buffer of headroom, has become quicker and more responsive over the years. It works well, even for those who use ELB to support higher usage during live broadcasts, flash sales, and holidays.
What are the benefits of Network Load Balancer?
Network Load Balancers take requests from clients and distribute them across targets in a target group, such as EC2 instances. Learn more about the benefits of Network Load Balancers in the following grid block.
Low latency
Network Load Balancers offer extremely low latencies for latency-sensitive applications. They will attempt to route a series of requests from a particular source to targets in a single Availability Zone while providing low latency.
Static IP addresses
Network Load Balancers automatically provide a single static IP address for each Availability Zone (subnet). This IP address will remain the same throughout the life of the load balancer.
Long-lived TCP connections
Network Load Balancers support long-lived TCP connections that can handle connections that are open for months or even years.
DNS failover
Amazon Route 53 can direct traffic to load balancer nodes in other Availability Zones.
TLS offloading
Network Load Balancers support client TLS session termination. You can offload TLS termination tasks to the load balancer, while preserving the source IP address for your backend applications.
Integration with AWS services
Network Load Balancer is integrated with other AWS services such as Amazon EC2 Auto Scaling, Amazon Elastic Container Service (Amazon ECS), AWS CloudFormation, AWS Elastic Beanstalk, and Amazon CloudWatch.
How much does Network Load Balancer cost?
Network Load Balancer pricing is calculated based on each hour or partial hour that the load balancer is running and the number of Network Load Balancer Capacity Units (NLCUs) that it uses per hour. NLCU measures three dimensions on which the load balancer processes your traffic (averaged over an hour). These dimensions are as follows:
New connections or flows: Number of newly established connections or flows per second
Active connections or flows: Peak concurrent connections or flows, sampled per minute
Processed bytes: The number of bytes processed by the load balancer in gigabytes (GB)
3. Gateway Load Balancer
What does Gateway Load Balancer do?
Gateway Load Balancer helps you deploy, scale, and run virtual appliances by addressing architectural challenges. Gateway Load Balancer combines a transparent network gateway (that is, a single entry and exit point for all traffic) and a load balancer that distributes traffic and scales your virtual appliances with demand.
Gateway Load Balancer improves availability by routing traffic flows through healthy virtual appliances and reroutes flows when an appliance becomes unhealthy. You can use your own appliances in Amazon Web Services (AWS) and rely on Gateway Load Balancer to manage their scaling and availability, while retaining skillsets and existing processes.
You can also scale your virtual appliances elastically and reduce cost by load balancing traffic across a fleet of virtual appliances. Gateway Load Balancer sends both directions of the traffic flow to the same appliance, allowing the appliance to perform stateful traffic processing.
In addition, with Gateway Load Balancer, you can add custom logic or third-party offerings into any AWS networking path where you want to inspect and act on packets.
Why do you need Gateway Load Balancer?
Gateway Load Balancer can deploy, scale, and manage virtual appliances, including firewalls, intrusion detection and prevention systems, and deep packet inspection systems. As the need for virtual appliance demand grows, it can scale and provide a transparent network gateway. Gateway Load Balancers pass all Layer 3 traffic transparently through Amazon Elastic Compute Cloud (Amazon EC2) instances, which can run third-party virtual appliances. It is invisible to the traffic source and destination.
Additonally, Gateway Load Balancer has characteristics of both a router and a load balancer. It operates in Layer 3 and does not change the source or destination IP, and it maintains stickiness and flow symmetry for traffic sent through it. It also performs health checks and allows auto scaling groups to manage its target groups.
As shown in the diagram, the source sends the traffic to destination. The Gateway Load Balancer receives the traffic and forwards it to a healthy, available appliance. Appliances then inspect the traffic and either send it back to the Gateway Load Balancer or drop it. Finally, the traffic arrives at the destination appearing unchanged. The response follows the same process in reverse through the same appliance.
What problems does Gateway Load Balancer solve?
Customers and partners face several challenges while moving their workloads to the cloud. Customers would like to keep third-party services that they are comfortable with. Moving to any new service will affect their architecture and may require design change. With Gateway Load Balancer, you can deploy inline networking and security as a managed service in single and multi-tenant designs. This allows customers to consume third-party services in a cloud-native way, and save time and money, while also reducing risks.
Subscribe to my newsletter
Read articles from Bhupendra directly inside your inbox. Subscribe to the newsletter, and don't miss out.
Written by
Bhupendra
Bhupendra
I'm a passionate software developer with a strong foundation in JavaScript, TypeScript, Node.js, and React. I've honed my skills in full-stack development and building scalable, user-friendly applications. I'm driven by creating innovative solutions that solve real-world problems and enhance user experiences. I'm a quick learner, constantly updating myself with the latest industry trends and best practices. Beyond technical skills, I value collaboration, problem-solving, and maintaining a growth mindset. I'm excited to contribute my expertise to a dynamic team and make a positive impact through technology.