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

ELB & ASG Summary

πŸ›‘οΈ High Availability (HA)

  • Runs across multiple Availability Zones 🌍

  • Keeps working through failures β€” an AZ outage, an instance crash


πŸ“ˆ Scalability

πŸ”Ό Vertical scaling

  • Make each instance bigger

  • Example: t2.micro β†’ t2.large

βž• Horizontal scaling

  • Add more instances

  • Works well with distributed systems

⚑ Elasticity

  • Scales up or down automatically based on demand πŸ“ˆπŸ“‰

  • You only pay for what you're using πŸ’°

πŸš€ Agility

  • Spin resources up or down in minutes

  • Speeds up development and deployment


Elastic Load Balancer (ELB)

What it does: Spreads traffic across your EC2 instances

Key features:

  • βš–οΈ Distributes load

  • 🌐 Gives you a single DNS entry point

  • πŸ›‘οΈ Health-checks instances and only routes to healthy ones

  • 🌍 Works across multiple AZs for high availability

Types of load balancers:

Type

Layer

Use case

🟦 ALB

Layer 7

HTTP/HTTPS, web apps 🌐

πŸŸ₯ NLB

Layer 4

High performance, TCP/UDP ⚑

🟩 GWLB

Layer 3

Security, firewalls πŸ”

⬜ CLB

Deprecated

Not on the exam ❌


Auto Scaling Groups (ASG)

What it does: Manages your EC2 instances automatically

Key features:

  • βž• Scales out (adds instances)

  • βž– Scales in (removes instances)

  • πŸ›‘οΈ Replaces unhealthy instances

  • 🎯 Keeps capacity at the desired level

Core settings:

Min      = minimum instances allowed
Desired  = target instance count
Max      = upper limit

ELB + ASG: A Powerful Combo

Architecture:

Users 🌍
   ↓
Load Balancer βš–οΈ
   ↓
Auto Scaling Group βš™οΈ
   ↓
EC2 Instances (dynamic) πŸ’»

What happens:

  • Traffic rises πŸ“ˆ β†’ ASG adds instances βž•

  • Traffic drops πŸ“‰ β†’ ASG removes instances βž–

  • ELB spreads traffic across whatever's running βš–οΈ

  • An unhealthy instance ❌ gets swapped out automatically πŸ›‘οΈ


Scaling Strategies

Strategy

Description

πŸ–οΈ Manual

You set capacity yourself

🚨 Step/Simple

Triggered by alarms

🌑️ Target Tracking

Holds a metric steady (e.g., CPU at 40%)

πŸ“… Scheduled

Triggered by time

πŸ€– Predictive

Forecasts demand with ML


Quick Recall

  • 🌍 HA β†’ multi-AZ

  • πŸ”Ό Vertical β†’ bigger machine

  • βž• Horizontal β†’ more machines

  • ⚑ Elasticity β†’ automatic scaling

  • πŸš€ Agility β†’ fast provisioning

  • βš–οΈ ELB β†’ traffic distribution

  • βš™οΈ ASG β†’ instance management


Takeaway

Together, ELB + ASG give you:

  • 🌍 High availability

  • πŸ“ˆ Scalability

  • ⚑ Elasticity

  • πŸš€ Agility

Real-world flow:

User traffic πŸ“ˆ
   ↓
ELB distributes βš–οΈ
   ↓
ASG scales instances βš™οΈ
   ↓
App stays fast, reliable, and cost-efficient βœ