DEV Community

Cover image for 📊AWS Load Balancers-Part 1
AKASH S
AKASH S

Posted on

📊AWS Load Balancers-Part 1

What is a Load Balancer?

In cloud computing, traffic isn't just about cars and roads — it’s about user requests and servers. A Load Balancer is like a traffic police officer at a junction, ensuring that vehicles (requests) are evenly distributed to available lanes (EC2 instances).

Without it, one server might crash due to heavy traffic while another sits idle. AWS Load Balancers help us avoid this by distributing load automatically and intelligently.

Types of Load Balancers in AWS:

AWS provides three types of load balancers under the Elastic Load Balancing (ELB) service:

Classic Load Balancer (CLB)

  • Legacy option; supports HTTP, HTTPS, and TCP
  • Simple round-robin routing
  • No advanced routing features

Application Load Balancer (ALB)

  • Used for HTTP and HTTPS
  • Supports path-based and host-based routing
  • Ideal for microservices and web apps

Network Load Balancer (NLB)

  • Designed for high-performance TCP and UDP traffic
  • Great for gaming, VoIP, real-time video streaming

Our Hands-On with Classic Load Balancer (CLB):

To understand how CLB works, we created two EC2 instances:

  • Each instance hosted a different static HTML page.
  • This allowed us to visually confirm where each request was being routed.

We then:

  • Created a Classic Load Balancer from the ELB dashboard.
  • Selected Internet-facing, configured VPC and availability zones.
  • Enabled HTTP (port 80) and SSH (port 22) in the Security Group.
  • Configured health checks using /index.html to monitor instance status.
  • Finally, we attached both instances to the load balancer.

When we visited the DNS name of the load balancer in our browser, we saw that it was alternating responses between the two EC2 instances thanks to the round-robin algorithm.

In Real World Example:

  • Imagine we’re at a food court with multiple counters. There's someone directing customers.
  • If one counter is full, they send the next customer to the next available one.
  • If a counter shuts down (instance fails), they stop directing people there.
  • That’s exactly how CLB works and it's basic, but it gets the job done.

It helped us understand:

  • How AWS distributes incoming traffic
  • The importance of health checks
  • Basic availability zone redundancy

But if we want smarter routing based on URL paths or subdomains, then it’s time to dive into ALB which we’ll explore in the next blog!📍📢

Top comments (0)