Cloud basicsLesson 4 of 17
Auto-Scaling VMs (Auto Scaling Groups)
An online store runs on two virtual machines. An auto scaling group adds VMs automatically when traffic spikes, replaces broken ones, and removes some when things quiet down. HPA, which does the same for Pods, is covered in Scaling with Load (HPA). Here we look one layer below: the number of servers (VMs) going up and down.
Average CPU40%
Desired (min 2 · max 4)2
VMs serving2
RequestResponse / reportWatchAppears in a later step
What you will learn
- What the launch template and min/desired/max counts do
- How a metric alarm changes the desired count
- A new VM serves only after passing health checks
- The group replaces broken VMs on its own
- Why scale-in uses a cooldown
Auto scaling group names (AWS · Azure · GCP)
| Concept | AWS | Azure | GCP |
|---|---|---|---|
| Auto-scaling group of VMs | Auto Scaling group | Virtual Machine Scale Sets | Managed instance group (MIG) |
| VM blueprint | Launch template | Scale set VM model | Instance template |
| Replace VMs failing health checks | Health check-based replacement | Automatic instance repairs | Autohealing |
Try it yourself
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <asg> --query 'AutoScalingGroups[].[MinSize,DesiredCapacity,MaxSize]' # min/desired/max (AWS example)
aws autoscaling describe-auto-scaling-groups --auto-scaling-group-names <asg> --query 'AutoScalingGroups[].Instances[].[InstanceId,LifecycleState,HealthStatus]' --output table # VMs and their health
aws ec2 describe-launch-template-versions --launch-template-id <lt-id> --versions '$Latest' # The launch template blueprint
aws autoscaling describe-policies --auto-scaling-group-name <asg> # Scaling policies tied to alarms
aws autoscaling describe-scaling-activities --auto-scaling-group-name <asg> --max-items 5 # Recent scale out/in and replacements
Check yourself
Further reading: Amazon EC2 Auto Scaling (AWS) · Node Autoscaling (Kubernetes docs) · Scaling with Load (HPA)