Skip to main content
Skip to main content
Still in beta — questions, comments or suggestions? aramb@aramb.dev

Auto Scaling Basics

Learn how Amazon EC2 Auto Scaling helps you maintain application availability and handle traffic changes automatically.

15 min
Introductory
AWS Free TierFREE TIER

All services used in this lesson are covered by the AWS Free Tier.

AWS Services Used

Amazon EC2 Auto ScalingFree (you only pay for the EC2 instances it launches)

Learning outcomes

By the end of this lesson, you will be able to:

  1. Explain what Amazon EC2 Auto Scaling does.
  2. Define an Auto Scaling group.
  3. Explain minimum, desired, and maximum capacity.
  4. Describe how Auto Scaling works with health checks and load balancers.
  5. Recognize target tracking as a straightforward scaling policy.

What Auto Scaling does

Auto Scaling helps your EC2 application automatically keep the right number of instances running. It ensures you have the correct amount of compute power to handle your application's load at any given time.

A simple memory rule:

  • Load Balancer = Spreads the traffic.
  • Auto Scaling = Changes how many instances exist.

1) What is an Auto Scaling group (ASG)?

An Auto Scaling group is a collection of EC2 instances that are managed as a single unit. Instead of managing individual servers, you tell AWS the "rules" for the group, and Auto Scaling handles the rest.

To create an ASG, you usually need:

  • Launch Template: The "blueprint" (AMI, instance type, key pair) used to start new instances.
  • Capacity Settings: The limits for how small or large the group can be.
  • Scaling Policies: The logic that tells the group when to grow or shrink.

2) The Three Capacity Numbers

These three settings are the heart of how an Auto Scaling group behaves:

Minimum Capacity

The lowest number of instances the group will ever have. Even if there is no traffic, Auto Scaling will keep this many instances running for basic availability.

Desired Capacity

The number of instances the group tries to maintain right now. If an instance fails, Auto Scaling will automatically launch a new one to get back to this number.

Maximum Capacity

The absolute limit on how many instances the group can grow to. This protects you from unexpected cost spikes by capping your total instance count.

Tip

Example: If Min=2, Desired=3, and Max=6, your group will try to keep 3 servers running. If traffic spikes, it can grow up to 6. If traffic vanishes, it will never drop below 2.


3) Self-Healing with Health Checks

Auto Scaling isn't just about traffic spikes; it's also about reliability. It continuously monitors the health of every instance in the group.

If an instance becomes "unhealthy" (e.g., the software crashes or the hardware fails), Auto Scaling will:

  1. Terminate the unhealthy instance.
  2. Launch a brand-new instance from your template.
  3. Restore your desired capacity automatically.

4) Target Tracking: "Set it and Forget it"

How does the group know when to scale? The most straightforward method is a Target Tracking Scaling Policy.

You choose a metric (like average CPU usage) and a target value (like 50%). Auto Scaling then acts like a thermostat:

  • CPU > 50%? It launches more instances to share the load.
  • CPU < 50%? It terminates unneeded instances to save you money.

5) Better Together: ELB + ASG

When you pair a Load Balancer with an Auto Scaling Group, you get a professional, high-availability architecture:

  1. Users connect to the Load Balancer.
  2. Auto Scaling adds/removes instances based on traffic.
  3. Load Balancer automatically starts sending traffic to new instances as soon as they are "healthy."

Micro-activity 1: Read the Group Settings

Micro-Activity

Auto Scaling Capacity

Based on the group settings, what is the current behavior?

Examples

Choose one, then match it on the right

Characteristics

Select an example first

0 of 4 matched so far.

Micro-activity 2: Choose the Better Tool

Micro-Activity

ELB vs Auto Scaling

Which service is responsible for which task?

Examples

Choose one, then match it on the right

Characteristics

Select an example first

0 of 4 matched so far.


Summary

Amazon EC2 Auto Scaling ensures your application has exactly the right amount of compute power. By using Auto Scaling Groups and Target Tracking, you can build applications that "self-heal" from failures and "self-scale" to handle any amount of traffic without manual intervention.


Knowledge Check

Knowledge Check
1 / 5

What is the primary purpose of an Auto Scaling group?

Next lesson

Lesson 4.7: Horizontal vs Vertical Scaling