AWS Certified Cloud Practitioner / ELB & ASG - Elastic Load Balancing & Auto Scaling Groups

Section Cleanup ELB & ASG

❌ Don't Do This

Terminating EC2 instances directly (instead of adjusting the ASG)

Why it doesn't work

ASG detects a missing instance ❌
   → automatically launches a replacement 💻

Result: You can't scale down this way — the instance you deleted just gets replaced.

Key idea

👉 The ASG is in control of its EC2 instances — not you directly.

What's happening behind the scenes

You delete an EC2 instance ❌
       ↓
ASG detects the mismatch ⚠️
       ↓
ASG launches a new EC2 instance 💻

To actually reduce capacity, you need to change it through the ASG itself (lower the desired capacity, or terminate via the ASG so it doesn't auto-replace the instance).


✅ Correct Cleanup Order

1. ⚙️ Delete the Auto Scaling Group

Steps:

  • Go to Auto Scaling Groups

  • Select DemoASG

  • Click Delete

  • Type delete to confirm

What happens: The ASG is removed ❌, and its managed EC2 instances are terminated automatically 💻

2. ⚖️ Delete the Load Balancer

Steps:

  • Go to Load Balancers

  • Select your Application Load Balancer (ALB)

  • Click Delete

Why: Avoids unnecessary resources running and keeps the environment clean

3. Target Group 🎯 (optional)

Do you need to delete it? No.

Why not:

  • Doesn't cost anything 💰

  • It'll just sit empty once the instances are gone


📊 Final State Checklist

Resource

Status

⚙️ Auto Scaling Group

❌ Deleted

💻 EC2 Instances

❌ Gone

⚖️ Load Balancer

❌ Deleted

🎯 Target Group

✅ Empty (safe to leave)


💡 Exam tips

  • The ASG always works to maintain its desired capacity

  • Deleting EC2 instances manually accomplishes nothing — they just get replaced

  • Always delete the ASG first

🧠 Memory trick

"ASG owns EC2"

Delete ASG → EC2 instances go with it
Delete EC2 → ASG just recreates them