Loading source
Pulling the file list, source metadata, and syntax-aware rendering for this listing.
Source from repo
Select, configure, and scale Azure compute resources—VMs, App Service, AKS, and Container Apps
Files
Skill
Size
Entrypoint
Format
Open file
Syntax-highlighted preview of this file as included in the skill package.
references/vmss-guide.md
1# VMSS Guide23Determine when to recommend a Virtual Machine Scale Set (VMSS) over a single VM, and which VMSS configuration to suggest.45> **Note:** This reference provides quick guidance but may become stale. Always verify VMSS features, limitations, and orchestration mode capabilities by fetching the latest documentation from:6> - https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/overview7> - https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-autoscale-overview8> - https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/orchestration-modes-api-comparison910## What Is a VM Scale Set?1112A VMSS creates and manages a group of load-balanced, identically configured VM instances. Key capabilities:1314- **Autoscale** — automatically add/remove instances based on metrics or schedules15- **High availability** — spread instances across fault domains and Availability Zones16- **Load balancing** — integrate with Azure Load Balancer (L4) or Application Gateway (L7)17- **Large scale** — up to 1,000 instances per scale set (marketplace images)18- **No extra cost** — you pay only for the underlying VM instances, storage, and networking1920## When to Recommend VMSS vs Single VM2122| Scenario | Recommend | Reasoning |23| ----------------------------------------------------- | --------- | ------------------------------------------- |24| Stateless web/API behind a load balancer | VMSS | Homogeneous fleet, autoscale on demand |25| Batch or parallel compute jobs | VMSS | Scale out for jobs, scale to zero when idle |26| Autoscale needed (CPU, queue depth, schedule) | VMSS | Built-in autoscale rules |27| Microservices with identical replicas | VMSS | Consistent config, rolling updates |28| High availability across zones (many instances) | VMSS | Automatic zone distribution |29| Single long-lived server (jumpbox, domain controller) | VM | No scaling benefit; simpler config |30| Unique per-instance configuration | VM | Scale sets assume identical instances |31| Quick proof of concept or dev/test | VM | Faster to stand up, lower complexity |3233## Orchestration Modes3435VMSS supports two orchestration modes. **Flexible** is recommended for all new workloads.3637| Feature | Flexible (recommended) | Uniform (legacy) |38| ------------------------ | ---------------------- | ---------------- |39| Mix VM sizes in one set | ✅ Yes | ❌ No |40| Add existing VMs to set | ✅ Yes | ❌ No |41| Availability Zone spread | ✅ Automatic | ✅ Automatic |42| Fault domain control | ✅ Yes | ✅ Yes |43| Max instances | 1,000 | 1,000 |44| Spot instances | ✅ Yes | ✅ Yes |45| Single-instance VMSS | ✅ Yes | ❌ No |46| VM model updates | Automatic, Manual, Rolling | Automatic, Manual, Rolling |4748> **Warning:** Orchestration mode cannot be changed after creation. Always recommend Flexible unless the user has a specific Uniform requirement.4950## Autoscale Patterns5152| Pattern | Trigger | Example |53| ------------------ | ---------------------------------------- | ------------------------------------------------------------ |54| **Metric-based** | CPU, memory, queue length, custom metric | Scale out when avg CPU > 70% for 5 min |55| **Schedule-based** | Time of day, day of week | Scale to 10 instances Mon–Fri 8 AM; scale down to 2 at night |56| **Combined** | Metric + schedule together | Baseline schedule with metric burst capacity |57| **Predictive** | ML-forecasted demand (preview) | Pre-scale before expected traffic spike |5859### Autoscale Best Practices6061- Set a **minimum instance count ≥ 2** for production HA62- Use a **cool-down period** (default 5 min) to avoid flapping63- Scale out aggressively, scale in conservatively (asymmetric rules)64- Monitor with [Azure Monitor autoscale diagnostics](https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-best-practices)6566## Networking6768| Component | When to Use |69| ----------------------- | ------------------------------------------------------------------------ |70| **Azure Load Balancer** | Layer-4 (TCP/UDP) traffic distribution; most common for backend services |71| **Application Gateway** | Layer-7 (HTTP/HTTPS) with TLS termination, URL routing, WAF |72| **No load balancer** | Batch/HPC jobs where instances pull work from a queue |7374## Cost Estimation Tips7576- VMSS itself is **free** — cost is the sum of per-instance VM pricing77- Estimate at **min** and **max** instance counts for autoscale budgets78- Use **Spot instances** in VMSS for up to 90% savings on interruptible workloads79- Combine with **Reservations** or **Savings Plans** on the baseline instance count8081## Key VMSS Limits8283| Limit | Value |84| -------------------------------------- | ---------------------------------- |85| Max instances per scale set | 1,000 (marketplace/gallery images) |86| Max instances (managed image) | 600 |87| Scale sets per subscription per region | 2,500 |88| Scale operations concurrency | Up to 1,000 VMs in a single batch |8990## Further Reading9192- [VMSS orchestration modes](https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-orchestration-modes)93- [Autoscale best practices](https://learn.microsoft.com/en-us/azure/azure-monitor/autoscale/autoscale-best-practices)94- [VMSS networking](https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/virtual-machine-scale-sets-networking)95- [VMSS Flexible portal quickstart](https://learn.microsoft.com/en-us/azure/virtual-machine-scale-sets/flexible-virtual-machine-scale-sets-portal)96