Scaling Policies for Auto Scaling Groups (ASG) in AWS
Auto Scaling Groups (ASG) allow for automatic scaling of EC2 instances based on defined rules. In this session, we will explore the different scaling policies available for ASG, their use cases, and best practices.
1. Types of Scaling Policies
A. Dynamic Scaling
Dynamically adjusts the number of instances based on real-time metrics.
1️⃣ Target Tracking Scaling (Recommended for Simplicity)
- Define a metric (e.g., CPU utilization) and a target value (e.g., 40%).
- ASG automatically scales out (adds instances) or scales in (removes instances) to maintain this target.
- Example: If CPU usage goes above 40%, ASG adds instances; if it drops below 40%, ASG removes instances.
2️⃣ Simple or Step Scaling
- Uses CloudWatch alarms to trigger scaling actions.
- You define thresholds:
- If CPU > 70% → Add 1 instance
- If CPU < 30% → Remove 1 instance
- More fine-tuned but requires manual configuration.
B. Scheduled Scaling
- Pre-defines scaling actions based on a known pattern of usage.
- Example: If you expect high traffic at 5 PM on Fridays, you can schedule ASG to increase minimum capacity to 10 instances beforehand.
C. Predictive Scaling