Ravindra BagaleCourses & study guides मराठी Track your progress

Chapter 18: Load Balancing

AWS Cloud

18.2 How many EC2 instances

Why the count is your choice

Students see one DNS name and think there is one computer. There is not. The load balancer is not your EC2. It does not run your Nginx, your PHP, or your files. Your EC2 instances do that. You choose how many of those instances are registered. One is enough for the balancer to return a page. One is not enough when that instance stops. This lab uses two so you can stop one and still get a page.

What the numbers mean

Number Meaning in this chapter
The load balancer Not an EC2. You do not SSH to it and install Nginx
Minimum that still answers 1 healthy target
This lab 2 EC2 instances, both registered
Chapter 17 Auto Scaling group Minimum 1, and the lab there used desired 1 then 2, maximum 3. The group can change the count. The balancer does not pick a number by itself

Separate three situations. With no registered targets, or only unused targets, an ALB returns 503. If all registered targets are unhealthy, it can fail open and still try them. A 502 instead points to a bad response or connection problem. DNS resolving successfully does not prove the application is working.

How to count them before you build the balancer

  1. Open the EC2 console.
  2. Count the running instances you will put behind the balancer.
  3. Write that count. For this lab, write 2.
  4. Confirm neither of those two is the load balancer. The load balancer is not in the instance list.
  5. You should see two running instances, and no row named "load balancer" in that instance list.

Later, when the Auto Scaling group changes desired capacity, come back to this count. The target group list grows or shrinks. The load balancer's own name stays one name.

Extra depth

Re-read the original short section at the top of the page, then this expansion. Together they should exceed a solid lesson length. If anything still feels thin, add your own lab screenshot and a paragraph in your notebook — that personal evidence is what interviews ask for.

  • Permission before tools.
  • Patch and config before exploits.
  • Logs and backups before blame.
  • Teach one junior the warning from this page.