1.Auto Scaling Group vocabulary
An Auto Scaling Group keeps a fleet of instances at a target size — never below min, never above max, and always trying to reach desired — launching them from a launch template, and replacing any instance that fails a health check.
Key features
- min/max/desired: the three numbers that bound and target the group's size
- Launch template: the recipe (AMI, instance type, user data) for every new instance
- Health check: EC2 status checks by default, or a custom check (e.g. an ELB health check)
- Lifecycle hooks: pause an instance mid-launch or mid-terminate to run custom actions
- A failed instance is replaced automatically to maintain desired capacity
The three capacity numbers and what each one does
- Minimum: 2 — the group never scales below this
- Desired: 4 — the active target
- Maximum: 10 — the group never scales above this
Command
aws autoscaling create-auto-scaling-group --auto-scaling-group-name app-asg \
--launch-template LaunchTemplateName=app-lt --min-size 2 --max-size 10 --desired-capacity 4 \
--vpc-zone-identifier "subnet-0a,subnet-0b"min ≤ desired ≤ max bounds and targets group size; a launch template defines what launches; and a lifecycle hook creates a window to run custom logic before an instance is actually launched or terminated.