HSR Sector 6 · Bangalore +91 96110 27980 Mon–Sat · 09:30–20:30
Chapter 11 of 20 — Cloud Computing Fundamentals — AWS Focus
intermediate Chapter 11 of 20

Elastic Load Balancing — Distributing Traffic

By Vikas Swami, CCIE #22239 | Updated Mar 2026 | Free Course

What is Load Balancing — Why Distribute Traffic Across Servers

In modern cloud infrastructure, ensuring high availability, fault tolerance, and optimal resource utilization hinges on effective traffic distribution among servers. Load balancing is the process of distributing incoming network or application traffic across multiple servers—also known as backend instances—to prevent any single server from becoming a bottleneck. This technique enhances application responsiveness, scalability, and resilience against failures.

Imagine a scenario where a popular e-commerce website experiences a sudden surge in visitors during a flash sale. Without load balancing, the server handling the website might become overwhelmed, leading to slow response times or crashes. By deploying a load balancer, the traffic can be evenly distributed across multiple servers, ensuring the website remains responsive and available. This distribution also facilitates maintenance activities, as individual servers can be taken offline without affecting overall service availability.

In AWS, the AWS Elastic Load Balancer (ELB) automates the process of distributing traffic based on preconfigured algorithms and health checks. It operates at various layers of the OSI model, enabling both Layer 4 (Transport Layer) and Layer 7 (Application Layer) load balancing. As a core component of AWS load balancing solutions, ELB ensures optimal resource utilization, improved application performance, and high availability for cloud-based applications.

Understanding the fundamentals of load balancing is crucial for designing scalable and reliable systems. It allows network administrators and developers to optimize the deployment of services, reduce latency, and enhance user experience. Networkers Home offers comprehensive training to master AWS load balancing techniques and harness the full potential of Elastic Load Balancer in real-world scenarios.

AWS ELB Types — ALB, NLB, GLB & Classic Load Balancer

Amazon Web Services provides multiple types of Elastic Load Balancers tailored to different application needs and network architectures. The primary categories include Application Load Balancer (ALB), Network Load Balancer (NLB), Gateway Load Balancer (GLB), and the Classic Load Balancer. Each type operates at different layers of the OSI model and offers distinct features suited for specific use cases.

Application Load Balancer (ALB) is designed for modern application architectures, supporting advanced routing features at Layer 7, such as path-based and host-based routing. It is ideal for microservices, container-based applications, and HTTP/HTTPS traffic.

Network Load Balancer (NLB) operates at Layer 4 (Transport Layer), providing ultra-low latency and high throughput. It is suitable for TCP, UDP, and other network protocols requiring high performance and static IP addresses.

The Classic Load Balancer (CLB) is the legacy option, supporting basic Layer 4 and Layer 7 load balancing. While still available, it is generally recommended to transition to ALB or NLB for new deployments due to enhanced features and performance.

The Gateway Load Balancer (GLB) is specialized for deploying, scaling, and managing third-party network appliances such as firewalls or intrusion detection systems in the cloud.

Below is a comparison table summarizing the key differences:

Feature Application Load Balancer (ALB) Network Load Balancer (NLB) Classic Load Balancer (CLB) Gateway Load Balancer (GLB)
Layer Layer 7 (Application) Layer 4 (Transport) Layer 4 & 7 Layer 3/4 (Network)
Protocols HTTP, HTTPS TCP, UDP HTTP, HTTPS, TCP Various (e.g., TCP/UDP)
Performance Moderate to high High throughput, low latency Basic performance Specialized for network appliances
Routing Features Path, Host-based routing None (simple forwarding) Basic load balancing Traffic steering for appliances
Use Cases Microservices, containerized apps, HTTP/HTTPS traffic High-performance TCP/UDP apps, gaming, IoT Legacy applications, simple load balancing Network appliances, security services

Choosing between ALB vs NLB depends on your application's protocol, performance requirements, and routing complexity. For web applications requiring advanced routing, ALB is preferred. For high-speed, protocol-specific scenarios, NLB excels. For detailed insights on AWS load balancing and how to select the right type, explore Networkers Home courses.

Application Load Balancer (ALB) — Layer 7, Path & Host Routing

The Application Load Balancer (ALB) operates at Layer 7 of the OSI model, enabling intelligent routing decisions based on application-level data such as URL paths and host headers. This capability allows developers to build highly flexible and scalable architectures—particularly suited for microservices and containerized environments like Amazon ECS and Kubernetes.

ALB supports features such as path-based routing, host-based routing, and routing rules that direct traffic to different target groups based on URL patterns or hostname headers. For example, an e-commerce platform might route requests with "/api" paths to its API servers, while serving static content from other servers. This granular routing capability reduces complexity and improves resource utilization.

Configuring an ALB involves defining listener rules. A typical setup includes creating a listener on port 80 or 443, then configuring rules like:

Rule 1: If path is /api/*, forward to API target group
Rule 2: If host is shop.example.com, forward to Shop target group
Rule 3: Default action: Forward to web target group

This setup ensures that traffic is efficiently directed to appropriate backend services, reducing latency and improving scalability. ALB also integrates seamlessly with AWS Certificate Manager (ACM) for SSL/TLS termination, enabling secure communication at the load balancer level.

Health checks are an essential part of ALB configuration. They regularly monitor target health status, removing unresponsive instances from the pool. The health check configuration includes parameters such as protocol, port, healthy/unhealthy threshold, and interval, which influence traffic distribution and fault tolerance.

In addition to routing, ALB supports WebSocket, HTTP/2, and user authentication through integration with AWS Cognito. These features make ALB a versatile choice for modern web applications. To master ALB configuration and deployment, visit Networkers Home for specialized training modules.

Network Load Balancer (NLB) — Layer 4, Ultra-Low Latency

The Network Load Balancer (NLB) is optimized for high performance, capable of handling millions of requests per second with ultra-low latency. Operating at Layer 4, NLB forwards TCP and UDP traffic directly, making it ideal for applications requiring high throughput, such as gaming, IoT, or financial trading platforms.

Unlike ALB, NLB does not inspect application data, which results in faster response times but less granular routing capabilities. It supports static IP addresses for each load balancer, providing consistent endpoints for clients and simplifying firewall configurations. NLB also offers integration with AWS PrivateLink, enabling private connectivity between VPCs.

Configuring an NLB involves creating a target group with TCP or UDP protocol, then registering targets such as EC2 instances or IP addresses. The load balancer distributes traffic based on flow hashing algorithms, ensuring even distribution and maintaining session stickiness if required. NLB supports TLS termination, allowing encryption offloading at the load balancer, which is essential for secure high-speed data transfer.

One of the key advantages of NLB is its ability to handle sudden traffic spikes without performance degradation. It is suitable for latency-sensitive applications, real-time data processing, and enterprise-grade workloads. For detailed NLB setup and comparison with ALB, consult Networkers Home Blog.

Target Groups — Instances, IPs, Lambda & Health Checks

Target groups are a fundamental component of AWS load balancing, acting as the destination for traffic forwarded by the load balancer. They can consist of EC2 instances, IP addresses, Lambda functions, or even containers. Proper configuration of target groups ensures efficient traffic distribution and health monitoring.

When creating a target group, you specify the target type:

  • Instance: Registers EC2 instances by their instance IDs.
  • IP: Registers specific IP addresses, enabling routing to on-premises or VPC resources outside AWS.
  • Lambda: Invokes Lambda functions directly, suitable for serverless architectures.

Health checks are integral to target groups, verifying target availability and responsiveness. They can be configured with parameters such as protocol (HTTP, HTTPS, TCP), port, path (for HTTP/HTTPS), interval, timeout, and thresholds. These checks prevent traffic from being routed to unhealthy targets, maintaining high availability.

For example, a target group for an ALB might be configured as follows:

aws elbv2 create-target-group --name my-target-group --protocol HTTP --port 80 --target-type instance --vpc-id vpc-12345678
aws elbv2 register-targets --target-group-arn arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-target-group --targets Id=i-1234567890abcdef Id=i-0987654321fedcba

Additionally, AWS provides CLI and SDK options for managing target groups programmatically, enabling automation and continuous deployment workflows. Mastery of target group configuration is essential for building resilient, scalable applications using Networkers Home.

SSL/TLS Termination — Offloading Encryption at the Load Balancer

SSL/TLS termination at the load balancer is a critical feature that offloads the computational overhead of encryption and decryption from backend servers. By terminating SSL/TLS at the AWS Elastic Load Balancer, organizations can simplify certificate management, improve performance, and enforce security policies centrally.

Configuring SSL/TLS termination involves uploading or importing SSL certificates into AWS Certificate Manager (ACM). The load balancer then uses these certificates to decrypt incoming traffic on port 443, forwarding unencrypted traffic to backend targets over HTTP or re-encrypting traffic as needed.

For ALB, enabling SSL/TLS involves creating a listener on port 443 with the SSL certificate attached. The configuration steps include:

  1. Request or import an SSL certificate in ACM.
  2. Create a security policy specifying supported protocols and ciphers.
  3. Set up an HTTPS listener on the ALB with the certificate.
  4. Configure target groups for backend instances, typically over HTTP.

Example CLI command to create an HTTPS listener:

aws elbv2 create-listener --load-balancer-arn arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/my-alb/1234567890abcdef --protocol HTTPS --port 443 --certificates CertificateArn=arn:aws:acm:region:account-id:certificate/certificate-id --default-actions Type=forward,TargetGroupArn=arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-target-group

SSL offloading at the load balancer enhances security by centralizing certificate management and reduces latency for backend servers. It also enables easier implementation of HTTPS for applications without modifying application code. For advanced SSL/TLS configurations and best practices, explore Networkers Home Blog.

Cross-Zone Load Balancing & Sticky Sessions

Cross-zone load balancing allows an Elastic Load Balancer to distribute incoming traffic evenly across registered targets in all enabled Availability Zones. This feature ensures that no single zone becomes a bottleneck, improving fault tolerance and resource utilization. When enabled, each load balancer node forwards traffic to targets in all zones, balancing the load globally.

Sticky sessions, also known as session affinity, enable a load balancer to route requests from a client to the same target for the duration of a session. This is achieved through cookies or duration-based affinity, which is essential for applications that maintain session state locally, such as shopping carts or user login sessions.

To enable cross-zone load balancing in AWS CLI:

aws elbv2 modify-load-balancer-attributes --load-balancer-arn arn:aws:elasticloadbalancing:region:account-id:loadbalancer/app/my-alb --attributes Key=load_balancer_cross_zone_enabled,Value=true

Similarly, sticky sessions can be configured via the console or CLI. For ALB, you enable stickiness at the target group level:

aws elbv2 modify-target-group-attributes --target-group-arn arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-target-group --attributes Key=stickiness.enabled,Value=true Key=stickiness.type,Value=lb_cookie Key=stickiness.lb_cookie.duration_seconds,Value=3600

Proper configuration of these features enhances user experience and ensures high availability. For comprehensive setup guides and best practices, refer to Networkers Home Blog.

Load Balancer Architecture — Multi-AZ, Auto Scaling Integration

Architecting AWS load balancers with Multi-AZ deployment and Auto Scaling ensures high availability and scalability. When an Elastic Load Balancer is deployed across multiple Availability Zones, it automatically distributes traffic to healthy targets in all zones, providing fault tolerance against zone failures.

Integration with Auto Scaling allows backend instances to dynamically scale based on traffic demand. As the load increases, Auto Scaling launches new instances and registers them with target groups. Conversely, when demand drops, instances are terminated, ensuring optimal resource utilization.

Implementing this architecture involves creating a load balancer with subnets in multiple AZs, configuring target groups, and setting up Auto Scaling groups with scaling policies based on CloudWatch metrics such as CPU utilization or request count per target.

Example setup commands include:

aws autoscaling create-auto-scaling-group --auto-scaling-group-name my-asg --launch-configuration-name my-launch-config --min-size 2 --max-size 10 --desired-capacity 4 --vpc-zone-identifier "subnet-abc,subnet-def"
aws autoscaling attach-load-balancer-target-groups --auto-scaling-group-name my-asg --target-group-arns arn:aws:elasticloadbalancing:region:account-id:targetgroup/my-target-group

This architecture ensures that traffic is balanced across multiple zones, instances scale seamlessly with demand, and system resilience is maximized. To learn more about designing resilient AWS architectures, visit Networkers Home.

Key Takeaways

  • Load balancing distributes incoming traffic to ensure high availability and fault tolerance in cloud architectures.
  • AWS offers multiple Elastic Load Balancer types: ALB, NLB, GLB, and Classic, each suited for specific use cases.
  • Application Load Balancer (ALB) provides Layer 7 routing features like path and host-based routing, ideal for modern web apps.
  • Network Load Balancer (NLB) operates at Layer 4, supporting high throughput and ultra-low latency TCP/UDP traffic.
  • Target groups define the backend resources—instances, IPs, or Lambda functions—and include health check configurations for fault tolerance.
  • SSL/TLS termination at the load balancer simplifies certificate management and enhances security.
  • Features like cross-zone load balancing and sticky sessions improve distribution efficiency and user experience.
  • Deploying load balancers across multiple AZs and integrating with Auto Scaling creates resilient, scalable systems.

Frequently Asked Questions

What is the main difference between ALB and NLB?

The primary difference lies in their operating layers and use cases. ALB functions at Layer 7, offering advanced routing features like path-based and host-based routing, making it suitable for HTTP/HTTPS traffic and microservices architectures. NLB, on the other hand, operates at Layer 4, providing high throughput and low latency for TCP/UDP traffic, ideal for high-performance, latency-sensitive applications. Choosing between them depends on your application's protocol requirements and routing complexity.

How do I configure SSL/TLS termination on an AWS Elastic Load Balancer?

To configure SSL/TLS termination, first obtain or import an SSL certificate in AWS Certificate Manager (ACM). Then, create a listener on port 443 with the HTTPS protocol and attach the certificate. This setup decrypts incoming traffic at the load balancer, reducing backend load and simplifying security management. You can also enable re-encryption by configuring the target group to use HTTPS or TCP. Proper SSL configuration ensures secure data transmission and compliance with security standards.

Can I use both ALB and NLB in the same architecture?

Yes, combining ALB and NLB within a single architecture is common to meet diverse application requirements. For example, an application might use an ALB for HTTP/HTTPS traffic with advanced routing, while also deploying an NLB for high-performance TCP or UDP connections. AWS supports such hybrid architectures, allowing each load balancer to handle specific traffic types and routing policies. Proper planning ensures efficient resource utilization and seamless user experience, which is a key aspect of AWS cloud design and can be mastered at Networkers Home.

Ready to Master Cloud Computing Fundamentals — AWS Focus?

Join 45,000+ students at Networkers Home. CCIE-certified trainers, 24x7 real lab access, and 100% placement support.

Explore Course