Compute: VMs & Scale Sets

💤0
Lv 10 XP
← ☁️ Microsoft Azure · AZ-104 Administration

Compute: VMs & Scale Sets

Intermediate ⭐ 80 XP ⏱ 18 min #azure#az-104#compute#vm

Deploy and scale virtual machines, and choose between VMs, scale sets, and containers.

📖Theory

Virtual Machines are Azure’s IaaS compute. You choose a size (VM series for general/compute/memory/GPU workloads), an image (OS), and disks (managed, Premium SSD for production). For availability, spread VMs across availability zones or an availability set.

To scale, Virtual Machine Scale Sets (VMSS) run identical VMs behind a load balancer and autoscale on metrics like CPU. For containerized or serverless work you’d instead pick AKS or Container Instances — but VMs remain the go-to for lift-and-shift and full OS control.

🌍Real-World Example
az vm create -g rg-app -n vm-web \
  --image Ubuntu2204 --size Standard_B2s \
  --admin-username azureuser --generate-ssh-keys --zone 1

# A scale set that autoscales on CPU
az vmss create -g rg-app -n vmss-web --image Ubuntu2204 \
  --instance-count 2 --vm-sku Standard_B2s
az monitor autoscale create -g rg-app --resource vmss-web \
  --resource-type Microsoft.Compute/virtualMachineScaleSets \
  --min-count 2 --max-count 10 --count 2
✍️Hands-On Exercise
  1. Choose a VM series for a memory-heavy database vs a CPU-bound batch job.
  2. Explain how a scale set differs from a single VM.
  3. Describe an autoscale rule: add an instance when CPU > 70% for 5 minutes.
  4. Compare availability zones vs availability sets for resilience.
🧾Cheat Sheet
ItemDetail
VM size seriesB (burst), D (general), E (memory), F (compute)
DisksStandard/Premium SSD, managed
Availability setFault/update domains (one DC)
Availability zonesSeparate datacenters
VMSSIdentical VMs + autoscale
Autoscale metricCPU %, queue length, schedule
💬Common Interview Questions
What is a Virtual Machine Scale Set?

A group of identical, load-balanced VMs that can automatically scale in/out based on metrics or a schedule — used for elastic, stateless workloads.

Availability set vs availability zone — what's the difference?

An availability set distributes VMs across fault/update domains within one datacenter; availability zones place them in physically separate datacenters, protecting against a full-datacenter outage.

📚Official Documentation

📝 My notes on this topic

Auto-saves as you type