AzureAzure Virtual MachinesCompute

azurerm_linux_virtual_machine_scale_set cost estimation

A group of identical Linux VMs that scales as a unit. Priced per instance-hour by VM size times the instance count, plus per-instance managed OS disks.

An azurerm_linux_virtual_machine_scale_set (VMSS) runs N identical VMs behind a single resource, scaling in and out based on rules or a fixed count. The cost is straightforward once you see it as "one VM price times the instance count": the per-hour rate for the VM size (sku) multiplied by the number of instances, plus a managed OS disk per instance.

The size rate is the same Linux VM rate you'd pay for a standalone azurerm_linux_virtual_machine. A Standard_D2s_v5 is about $0.096/hour, so 3 of them is roughly $210/month for compute alone, before disks. c3x reads the sku and instances (the fixed capacity) and multiplies. For autoscaling sets, the estimate uses the configured baseline instance count, since c3x prices the declared infrastructure, not runtime scaling behavior.

Each instance gets a managed OS disk, billed per instance per month by disk tier. c3x adds the OS disk cost across all instances. Linux and Windows scale sets are priced differently (Windows adds the OS license), and c3x discriminates on the OS so a Linux set is never charged the Windows rate.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "azurerm_linux_virtual_machine_scale_set" "web" {
  name                = "web-vmss"
  resource_group_name = azurerm_resource_group.app.name
  location            = "eastus"
  sku                 = "Standard_D2s_v5"
  instances           = 3

  admin_username = "azureuser"

  os_disk {
    storage_account_type = "Premium_LRS"
    caching              = "ReadWrite"
  }

  network_interface {
    name    = "primary"
    primary = true
    ip_configuration {
      name      = "internal"
      primary   = true
      subnet_id = azurerm_subnet.web.id
    }
  }
}

Pricing dimensions

What you actually pay for when you provision azurerm_linux_virtual_machine_scale_set.

DimensionUnitWhat's being charged
Instance hoursper instance-hourPer-hour rate for the VM size, billed for every instance in the set. Total = sku rate x instances. c3x assumes 730 hours/month.
$0.096/hour for Standard_D2s_v5 Linux in eastus
Managed OS disksper disk-monthOne managed OS disk per instance, billed by tier (Premium SSD P10 etc.). c3x prices one disk per instance.
$19.71/month per P15 Premium SSD
Data transfer outper GBEgress to the internet from the instances. Usage-based; define in c3x-usage.yml.

Sample C3X output

Example output from c3x estimate for the Terraform above:

azurerm_linux_virtual_machine_scale_set.web
├─ Instances (Standard_D2s_v5 x 3)   2,190  instance-hours   $210.24
└─ OS disks (Premium, x 3)               3  disk-month        $59.13

OVERALL TOTAL                                                $269.37

Optimization tips

Common ways to reduce azurerm_linux_virtual_machine_scale_set cost without changing the workload.

Use Spot instances for fault-tolerant workloads

60-90%

Setting priority to Spot on a scale set can cut the per-instance rate by 60-90% for stateless or batch workloads that tolerate eviction. Not for stateful services.

Pick the latest VM generation

10-20%

Dsv5/Dsv6 deliver better price-performance than Dsv3/Dsv4 at a similar or lower hourly rate. Moving a set up a generation usually lowers cost per unit of work.

Set autoscaling minimums realistically

Per idle instance

Every baseline instance runs 24/7. If your floor traffic only needs 1 instance, don't set the minimum to 3. Scale up on demand instead.

Reserve or savings-plan the steady baseline

Up to 40%

The always-on baseline instances are ideal for a 1- or 3-year reservation (~40% off) or an Azure savings plan for compute.

FAQ

How does c3x estimate a VM scale set?

It reads the sku (VM size) and instances (capacity), prices the Linux per-hour rate times the instance count at 730 hours/month, and adds one managed OS disk per instance. For autoscaling sets it uses the declared baseline instance count.

Does c3x price autoscaling behavior?

No. c3x estimates the declared infrastructure using the configured instance count. Runtime autoscaling is dynamic; the estimate reflects the baseline you've defined, which is the right number for a pre-deploy cost check.

Are Linux and Windows scale sets priced the same?

No. Windows adds an OS license surcharge to the hourly rate. c3x discriminates on the OS so a Linux scale set is priced at the Linux rate, not the Windows rate.

Is the load balancer included?

No. A scale set typically sits behind an azurerm_lb, which c3x prices as its own resource if it's in your Terraform.

How are the OS disks priced?

Each instance gets one managed OS disk, billed per month by its tier (Premium/Standard SSD or HDD). c3x maps disk_size and account type to the tier and multiplies by the instance count.

Related resources

Estimate this resource in your own Terraform

Free, open source, no API key. C3X parses your Terraform and shows line-item cost for every resource, including azurerm_linux_virtual_machine_scale_set.