Azure Virtual Machine Scale Sets

Azure Virtual Machine Scale Sets

Virtual Machine Scale Sets (VMSS) let you deploy and manage a group of identical, load-balanced virtual machines. This allows for rapid scaling of your application infrastructure to meet demand. VMSS provides features such as automatic scaling based on performance metrics, rolling OS and application upgrades, and flexible deployment options.

Key Concepts

Benefits

Getting Started

Creating a Scale Set

You can create a VM Scale Set using the Azure portal, Azure CLI, Azure PowerShell, or ARM templates.

Using Azure CLI:

az vmss create \
    --resource-group myResourceGroup \
    --name myScaleSet \
    --image Ubuntu22_04 \
    --instance-count 3 \
    --admin-username azureuser \
    --generate-ssh-keys

Configuring Automatic Scaling

Automatic scaling can be configured to scale out (add instances) when load increases and scale in (remove instances) when load decreases.

Note: Ensure your application is designed to handle instances being added or removed gracefully.

Example of a scaling rule to add an instance when CPU is over 80% for 10 minutes:


{
  "properties": {
    "profiles": [
      {
        "name": "scaleOut",
        "capacity": {
          "minimum": 1,
          "maximum": 10,
          "default": 2
        },
        "ruleType": "ScaleOut",
        "scaleRuleMetric": {
          "metricName": "Percentage CPU",
          "statistic": "Average",
          "timeGrain": "PT1M",
          "timeWindow": "PT10M",
          "operator": "GreaterThan",
          "threshold": 80
        }
      }
    ]
  }
}
            

Common Scenarios

Application Health

VMSS can integrate with Azure Load Balancer or Application Gateway to perform health probes. Unhealthy instances are automatically replaced.

Learn More