Skip to content

Virtual Machine Scale Set

  • Used to scale up or scale down machines when the CPU used is getting closer to the limit
  • It will automatically scale up the number of VMs based on demand
  • Scale sets manages a group o identical VMs
  • A load balancer can be placed behind the VMs to distribute the traffic

Autoscaling configuration

  • A threshold can be defined to scale out (E.g., CPU>75% for 10min) or scale in (E.g., CPU<25% for 10min)
  • The maximum and minimum number of VMs can be defined

Load balancing

  • VMs in a scale set can be load balanced

Availability Zones

  • Availability Zones (AZ) are unique physical locations (datacenters) that are equipped with independent power, cooling and networking
  • AZs are contained in a single region! E.g., eastus
  • AZ is a collection of one or more data centers
  • There are normally 3 AZ in a region
  • Deploying VMs across different AZ decrease the velocity between the instances
  • Deploying VMs across different AZ increases protection from datacenter failures
  • Using different AZs ensure at least 99.99% SLA
  • A AZ can be specified upon VM creation or upon VMSS configuration (instances will be spread across the AZ)

ARM

  • Deploy the VMSS only after the Storage Account is in place
{
  "$schema": "https://schema.management.azure.com/schemas/2015-01-01/deploymentTemplate.json#",
  "contentVersion": "1.0.0.0",
  "parameters": {},
  "resources": [
    {
      "name": "[concat(copyIndex, 'storage', uniqueString(resourceGroup().id))]",
      "type": "Microsoft.Storage/storageAccount",
      "location": "[resourceGroup().location]",
      "apiVersion": "2019-06-01",
      "kind": "StorageV2",
      "sku": {
        "name": "Standard_LRS"
      },
      "dependsOn": [],
      "tags": {},
      "properties": {},
      "copy": {
        /* Multiple replicas */ "name": "storagesetup",
        "count": 3,
        "mode": "Serial",
        "batchSize": 1
      }
    },
    {
      "name": "[variables('jumpBoxName')]",
      "type": "Microsoft.Compute/virtualMachines",
      "location": "[parameters('location')]",
      "apiVersion": "2020-06-01",
      "dependsOn": []
    }
  ]
}