AzureAzure Virtual NetworkNetworking

azurerm_subnet cost estimation

A subnet is free. Carving an address range out of a virtual network costs nothing. The cost lives in the resources you place inside the subnet and the traffic they generate.

An azurerm_subnet is an address range carved out of a virtual network to group and isolate resources. Creating a subnet is free. Azure does not charge for the subnet, its address prefix, or the association of a network security group or route table to it.

Because subnets are free, they are often ignored in cost reviews, but they are where the real decisions live. Placing a subnet in a different region or zone from the resources it talks to creates cross-zone or cross-region traffic that is billed per GB. Delegating a subnet to a service like Azure SQL Managed Instance or attaching a NAT Gateway to it introduces a paid component that the subnet itself does not display. Private endpoints placed in a subnet carry an hourly and per-GB charge on the endpoint, not on the subnet.

The useful way to think about a subnet is as a placement decision. Which subnet a VM, database, or endpoint sits in determines the data transfer path and therefore the transfer bill. c3x prices the NAT Gateways, private endpoints, and workloads attached to a subnet and treats the subnet, its address prefix, and its NSG or route table associations as free.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "azurerm_resource_group" "main" {
  name     = "network-rg"
  location = "eastus"
}

resource "azurerm_virtual_network" "main" {
  name                = "main-vnet"
  resource_group_name = azurerm_resource_group.main.name
  location            = azurerm_resource_group.main.location
  address_space       = ["10.0.0.0/16"]
}

resource "azurerm_subnet" "app" {
  name                 = "app"
  resource_group_name  = azurerm_resource_group.main.name
  virtual_network_name = azurerm_virtual_network.main.name
  address_prefixes     = ["10.0.1.0/24"]
}

Pricing dimensions

What you actually pay for when you provision azurerm_subnet.

DimensionUnitWhat's being charged
SubnetfreeThe subnet, its address prefix, and its NSG or route table association have no charge.
$0
Resources placed in the subnetvaries (billed elsewhere)VMs, private endpoints, and NAT Gateways attached to the subnet are billed on their own meters.
Cross-zone and cross-region trafficper GBTraffic between a subnet and resources in another zone or region, driven by where you place workloads.

Optimization tips

Common ways to reduce azurerm_subnet cost without changing the workload.

Place chatty tiers in the same zone

Subnet placement decides the traffic path. Keeping services that talk to each other in the same zone avoids cross-zone data transfer, which is metered per GB.

Share a NAT Gateway rather than one per subnet

~$32/month per gateway removed

Attaching a NAT Gateway to each subnet multiplies the hourly gateway charge. One NAT Gateway can serve several subnets in a region.

Use service endpoints for PaaS access

Enabling free service endpoints on the subnet keeps traffic to Storage or SQL on the Azure backbone instead of routing it through a metered NAT Gateway.

FAQ

Does an Azure subnet cost money?

No. Subnets, their address prefixes, and associating a network security group or route table are free. You pay only for the resources placed in the subnet and the traffic they generate.

Is there a charge for private endpoints in a subnet?

Yes, but the charge is on the private endpoint, not the subnet. Each private endpoint bills an hourly rate plus per-GB data processing regardless of which subnet it sits in.

Why does subnet placement affect my bill?

Because it decides the data transfer path. Resources in a subnet that talks across zones or regions generate per-GB transfer charges, so placement is a real cost lever even though the subnet is free.

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_subnet.