What You Will Learn
Intermediate
- What Auto Scaling Groups are
- How scaling policies work
- How to set up auto scaling
Vertical = bigger machine (limited). Horizontal = more machines (unlimited, cloud-native).
An Auto Scaling Group (ASG) automatically adds or removes EC2 instances based on demand. Traffic up = add instances. Traffic down = remove instances. You save money and handle spikes.
Key Components
| Component | What it does |
|---|---|
| Launch Template | Blueprint for new instances (AMI, type, security group) |
| Scaling Policy | When to scale (CPU > 70%? add instance) |
| Min/Max/Desired | Minimum, maximum, and desired instance count |
Typical setup
Min: 2 (always running), Desired: 2 (start here), Max: 10 (never more than 10). Scale when average CPU > 70% for 5 minutes.Practical Exercise
Go to EC2 -> Auto Scaling Groups
Create a Launch Template (AMI + t2.micro + security group)
Create an ASG with min=2, max=4, desired=2
Set a scaling policy: CPU > 70% for 5 min -> add 1 instance
Key Takeaways
- ASG automatically adds/removes EC2 instances based on demand.
- Launch Template = blueprint for new instances.
- Scaling Policy = when to scale (e.g., CPU > 70%).
- Min/Max/Desired controls the instance count range.
- Saves money: scale in when traffic is low.
Comments
Comments
Post a Comment