Overview
An Auto Scaling Group (ASG) is a crucial AWS feature that automatically adjusts the number of EC2 instances in response to traffic fluctuations. This ensures optimal performance while minimizing costs.
Key Features of ASG
1. Scaling Mechanisms
- Scale Out (Increase Instances) → Adds EC2 instances when load increases.
- Scale In (Decrease Instances) → Removes EC2 instances when load decreases.
- The ASG dynamically adjusts its size based on demand.
2. Capacity Settings
ASG configurations include three capacity parameters:
- Minimum Capacity → The lowest number of EC2 instances (e.g.,
2).
- Desired Capacity → The target number of EC2 instances (e.g.,
4).
- Maximum Capacity → The highest number of EC2 instances (e.g.,
7).
3. Health Management & Integration with Load Balancer
- If an EC2 instance becomes unhealthy, ASG terminates and replaces it automatically.
- ASG works with an Elastic Load Balancer (ELB) to distribute traffic evenly across healthy instances.
- The ELB performs health checks and informs the ASG, ensuring only healthy instances serve traffic.
4. Launch Templates
To create an ASG, you need a Launch Template (replacing the now-deprecated Launch Configuration). A launch template includes:
- AMI (Amazon Machine Image)
- Instance type