DEV Community

Anupa Supul
Anupa Supul

Posted on

Why Doesn't Everyone Connect to the Same Server? Understanding AWS Elastic Load Balancer (ELB)

While learning AWS, I noticed something interesting.

In almost every AWS architecture diagram, there was a service sitting in front of multiple servers.

It looked something like this:

Users
   │
   ▼
Load Balancer
   │
 ┌─┴─┐
 ▼   ▼
EC2 EC2
Enter fullscreen mode Exit fullscreen mode

At first, I didn't understand why it was there.

I kept thinking:

"Why can't users just connect directly to the server?"

After all, if the server is running my application, shouldn't users talk to it directly?

The more I learned, the more I realized that this simple service solves a huge problem.

And that's how I discovered AWS Elastic Load Balancer (ELB).


The Question That Made Me Curious

Imagine I build a website.

On a normal day, maybe 100 people visit it.

One server is enough.

Everything works smoothly.

Now imagine my website suddenly goes viral.

Thousands of people start visiting at the same time.

What happens?

Every request goes to the same server.

Eventually, that server becomes overwhelmed.

  • Pages become slow
  • Users start waiting
  • Requests fail
  • Visitors leave

That's when I realized:

The problem isn't just having servers.

It's deciding how traffic should be shared between them.


The Coffee Shop Analogy

This was the example that made everything click for me.

Imagine a coffee shop with only one cashier.

500 Customers
      │
      ▼
  1 Cashier
Enter fullscreen mode Exit fullscreen mode

The line becomes huge.

Customers wait.

Some leave before getting served.

Now imagine adding three more cashiers.

500 Customers
      │
      ▼
 ┌─────────┐
 │ Manager │
 └─────────┘
  │  │  │  │
  ▼  ▼  ▼  ▼
 C1 C2 C3 C4
Enter fullscreen mode Exit fullscreen mode

The manager directs customers to whichever cashier is available.

Nobody has to choose a cashier manually.

The workload gets distributed automatically.

That manager is basically what a Load Balancer does.


So... What Is an Elastic Load Balancer?

The simplest way I understand it is:

An Elastic Load Balancer automatically distributes incoming traffic across multiple servers.

Instead of sending every user to one server, AWS spreads the requests across several servers.

Benefits include:

  • Improved performance
  • Higher availability
  • Better fault tolerance
  • Handling traffic spikes

Without a Load Balancer

10,000 Users
      │
      ▼
     EC2
Enter fullscreen mode Exit fullscreen mode

One server has to handle everything.

If it fails, the application becomes unavailable.


With a Load Balancer

10,000 Users
       │
       ▼
 Load Balancer
   │    │    │
   ▼    ▼    ▼
 EC2  EC2  EC2
Enter fullscreen mode Exit fullscreen mode

Traffic gets shared.

Each server handles a smaller amount of work.

The application stays responsive.


What Happens If a Server Fails?

Without a Load Balancer:

Users
  │
  ▼
Failed Server ❌
Enter fullscreen mode Exit fullscreen mode

Website unavailable.

With a Load Balancer:

Users
  │
  ▼
Load Balancer
 │     │     │
 ▼     ▼     ▼
❌    EC2   EC2
Enter fullscreen mode Exit fullscreen mode

Traffic automatically moves to healthy servers.

Most users never notice anything happened.


How ELB Works With Auto Scaling

Internet Users
       │
       ▼
 Load Balancer
       │
 ┌─────┼─────┐
 ▼     ▼     ▼
EC2   EC2   EC2
       │
       ▼
 Auto Scaling
Enter fullscreen mode Exit fullscreen mode
  • Auto Scaling decides how many servers exist.
  • ELB decides where traffic goes.

Together, they keep applications scalable and highly available.


Final Thoughts

When I first saw Elastic Load Balancer in AWS diagrams, it looked like just another service with a complicated name.

Now I see it much more simply.

"If thousands of users arrive at the same time, who decides where each request should go?"

That's exactly the problem ELB solves.

And for me, it was another reminder that cloud computing isn't just about servers.

It's about designing systems that continue working even when demand grows.

Top comments (0)