AWS EC2 ELB Elastic Load Balancing

Day 6-Part 1: Prep- AWS Certified Cloud Practitioner | CLF-C02

AWS EC2 ELB Elastic Load Balancing

Link to exam:


Think of load balancing like a traffic officer at a bustling intersection: it guides visitors (like cars) to different routes (servers) so that none get overwhelmed. This keeps your website or app running smoothly, especially during busy times when many people are trying to access it at once. Amazon Web Services (AWS) Elastic Load Balancing (ELB) is the expert traffic officer here.

In this blog post, we'll delve into the world of load balancing and explore how AWS ELB empowers businesses to distribute incoming traffic across multiple targets for improved reliability and performance.

Understanding Load Balancing

Load balancing, at its core, is about efficiently distributing incoming network traffic across multiple servers or resources to enhance resource utilization, maximize throughput, minimize response time, and ensure high availability.

With EC2, load balancing works by spreading incoming web traffic across multiple EC2 instances. This prevents any single instance from becoming overloaded, thus improving performance and reliability. Essentially, it's like having multiple servers handling requests simultaneously, ensuring smooth user experiences even during peak traffic times.

The Importance of Load Balancing

Load balancing offers several key benefits for modern applications and websites:

  1. High Availability: By distributing traffic across multiple servers, load balancers help eliminate single points of failure, ensuring that applications remain accessible even if individual servers go offline.

  2. Scalability: Load balancers enable horizontal scaling by automatically distributing incoming traffic to additional servers as demand increases, allowing applications to handle a larger volume of requests without sacrificing performance.

  3. Improved Performance: By intelligently routing requests to the closest or least loaded server, load balancers help minimize latency and optimize response times, leading to a better user experience.

  4. Fault Tolerance: Load balancers continuously monitor the health of backend servers and remove any unhealthy or underperforming servers from the pool, ensuring that only healthy servers handle incoming requests.

Introducing AWS Elastic Load Balancing (ELB)

AWS offers a suite of load balancing solutions under the Elastic Load Balancing (ELB) service, designed to seamlessly distribute incoming traffic across multiple targets, such as Amazon EC2 instances, containers, and IP addresses, within and across AWS availability zones.

Key Features of AWS ELB

AWS ELB offers a plethora of features to meet the diverse needs of modern applications:

  1. Managed Service:

    • AWS takes responsibility for infrastructure maintenance, upgrades, and ensuring high availability.

    • Users are freed from managing load balancers, enabling focus on application development and deployment without operational overhead.

  2. Automatic Scaling:

    • ELB automatically scales its capacity to handle varying traffic levels, ensuring responsive applications during load spikes.
  3. Health Checks:

    • Continuous monitoring of backend instances with periodic health checks.

    • Automatically routes traffic away from unhealthy instances to maintain optimal performance.

  4. SSL Termination:

    • Supports SSL termination, offloading SSL/TLS decryption from backend instances.

    • Reduces CPU overhead and simplifies certificate management.

  5. Intelligent Routing:

    • Advanced routing capabilities offered by ALB, including path-based routing, host-based routing, and routing based on HTTP headers.

    • Enables flexible traffic management based on request attributes.

  6. Integration with Other AWS Services:

    • Seamless integration with Auto Scaling, AWS Certificate Manager, AWS WAF, and other AWS services.

    • Enhances functionality, security, and management capabilities within the ---AWS ecosystem.

Types of load balancers offered by AWS

The Elastic Load Balancing service encompasses four main types of load balancers, each optimized for different scenarios:

Image Reference :

Load Balancer TypeApplication Load Balancer (ALB)Network Load Balancer (NLB)Gateway Load Balancer(GWLB)Classic Load Balancer (Retired in 2023)
Layer of OperationLayer 7 (Application)Layer 4 (Transport)Layer 3 (Network)Layer 7 (Application)
Advanced Routing FeaturesContent-based routing, WebSocket, HTTP/2NoNoNo
Ultra-low LatencyNoYesYesNo
High ThroughputNoYesYesNo
Static IP AddressesNoYesYesNo
Use CasesModern web apps, microservicesHigh-performance apps, gamingHybrid architecturesBasic web apps, legacy systems
MaintenanceAWS managedAWS managedAWS managedAWS managed
Key FeaturesAdvanced routing, visibilityUltra-high performance, TLS offloading, centralized certificate deploymentFleet management of third-party virtual appliances-
Targeted atApplication architectures (microservices, containers)High performance, low latency applicationsDeployment of third-party virtual appliances-
Additional InfoOperating at request levelOperating at connection level--

If you are confused about networking layer you may refer to below diagram from reference

OSI Model: The 7 Layers of Network Architecture – BMC Software | Blogs

Integrating Auto Scaling Group(ASGs) with Load Balancer (ELBs)

Integrating Auto Scaling Groups (ASGs) with Load Balancers in AWS is a crucial step in building a scalable and reliable infrastructure for your applications. This integration ensures that your application can effectively handle varying levels of traffic while maintaining high availability. Let's delve deeper into how ASGs and Load Balancers work together:

1. ASG Configuration

When setting up an Auto Scaling Group, you define parameters such as the minimum and maximum number of instances, launch configurations, and scaling policies. These scaling policies determine when to add or remove instances based on predefined metrics like CPU utilization, network traffic, or custom CloudWatch metrics.

2. Load Balancer Setup

Simultaneously, you configure a Load Balancer to distribute incoming traffic across the instances launched by the ASG. Load Balancers come in different types, such as Classic Load Balancer, Application Load Balancer (ALB), and Network Load Balancer (NLB). For modern web applications, ALB is often preferred due to its advanced routing capabilities.

3. ASG Integration with Load Balancer

Within the ASG configuration, you specify the Load Balancer that should distribute traffic to the instances launched by the ASG. This linkage enables the Load Balancer to automatically adjust its routing as instances are added or removed by the ASG.

4. Dynamic Scaling

As the demand for your application fluctuates, the ASG monitors the defined metrics and scales the number of instances accordingly. When scaling out (adding instances), the ASG informs the Load Balancer about the new instances, ensuring that incoming traffic is distributed across the expanded fleet. Conversely, when scaling in (removing instances), the ASG removes instances gracefully from the Load Balancer's rotation to prevent disruption to existing connections.

5. Health Checks

Load Balancers continuously perform health checks on the instances registered with them to ensure they are capable of handling incoming requests. If an instance fails a health check, the Load Balancer stops sending traffic to that instance until it passes the check again. ASGs work in tandem with Load Balancers to replace unhealthy instances automatically, maintaining the overall health and reliability of the application.

Best Practices for Using AWS ELB

To maximize the benefits of AWS ELB, consider implementing the following best practices:

  1. Distribute Traffic Across Multiple Availability Zones: Deploy ELB in multiple availability zones to achieve high availability and fault tolerance, ensuring that your application remains accessible even in the event of an outage in a single zone.

  2. Enable Cross-Zone Load Balancing: Enable cross-zone load balancing to evenly distribute traffic across all healthy instances in all registered availability zones, improving overall performance and resource utilization.

  3. Optimize Health Checks: Fine-tune health check settings to ensure timely detection of unhealthy instances and minimize the risk of serving traffic to degraded or malfunctioning servers.

  4. Monitor and Analyze Performance: Utilize AWS CloudWatch metrics and ELB access logs to monitor the performance and health of your load balancers, identify trends, and troubleshoot any issues proactively.

  5. Implement Security Measures: Secure your load balancers by configuring security groups, enabling encryption, and integrating with AWS WAF to protect against common web exploits and DDoS attacks.

Step-By-Step Hands-On Guide

To dive deeper into creating and managing ELB, check out our step-by-step guide: AWS ELB Hands-On | A Step-by-Step Guide


AWS Elastic Load Balancing (ELB): Efficiently distributes network traffic across servers for enhanced resource utilization and high availability. Features automatic scaling, health checks, SSL termination, and integration with AWS services.

Types of AWS Load Balancers

  1. Classic Load Balancer: Basic web applications and legacy systems.

  2. Application Load Balancer (ALB): Modern web applications and microservices.

  3. Network Load Balancer (NLB): High-performance applications and gaming.

  4. Gateway Load Balancer: For hybrid architectures.

Integration with Auto Scaling Groups (ASGs)

  • Configuration: Define parameters and scaling policies.

  • Setup: Configure Load Balancer type (e.g., ALB) for traffic distribution.

  • Dynamic Scaling: ASG monitors metrics, scales instances, and updates Load Balancer routing.

  • Health Checks: Load Balancer ensures instance health and redirects traffic from unhealthy instances.

Best Practices for AWS ELB

  • Availability: Deploy ELB in multiple zones for high availability.

  • Load Balancing: Enable cross-zone load balancing for even distribution across instances.

  • Health Checks: Optimize settings for timely issue detection.

  • Monitoring: Use CloudWatch metrics and access logs for performance monitoring.

  • Security: Secure load balancers with encryption, security groups, and AWS WAF.