google_compute_subnetwork cost estimation
A subnetwork is free. It carves a regional IP range out of a VPC, and the cost comes from the resources placed in it and the traffic they generate.
A google_compute_subnetwork is the regional slice of a VPC where VMs and other resources get their internal IP addresses. Creating a subnetwork is free. Assigning primary and secondary CIDR ranges is free, and so is enabling Private Google Access on it. There is no per-subnet or per-IP-range charge.
Cost is driven by what you put in the subnet and where its traffic goes. VMs in the subnet carry their own compute and disk cost. Traffic between subnets in different zones bills per GB, traffic to other regions bills per GB, and internet egress from instances in the subnet is tiered per GB. Secondary ranges used for GKE Pods and Services are free to define, but the workloads that consume them are not.
One subnet feature has a genuine cost lever attached: enabling Private Google Access lets private VMs reach Google APIs without routing through a Cloud NAT gateway, which avoids NAT data-processing charges. c3x prices the VMs, NAT, and egress associated with a subnet and treats the subnet and its IP ranges as the free addressing layer they are.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "google_compute_subnetwork" "app" {
name = "app-subnet"
ip_cidr_range = "10.0.1.0/24"
region = "us-central1"
network = google_compute_network.main.id
private_ip_google_access = true
secondary_ip_range {
range_name = "pods"
ip_cidr_range = "10.4.0.0/14"
}
}Pricing dimensions
What you actually pay for when you provision google_compute_subnetwork.
| Dimension | Unit | What's being charged |
|---|---|---|
| Subnetwork and IP ranges | free | The subnet, its primary and secondary CIDR ranges, and Private Google Access have no charge. $0 |
| Inter-zone and inter-region egress | per GB | Traffic from resources in the subnet to other zones or regions. Inter-zone: $0.01/GB |
| Internet egress | per GB | Bytes leaving the subnet's instances to the public internet, tiered by destination after the free tier. ~$0.12/GB (Premium tier) |
Optimization tips
Common ways to reduce google_compute_subnetwork cost without changing the workload.
Enable Private Google Access
Removes NAT processing on Google API trafficTurning on private_ip_google_access lets private VMs reach Google APIs directly, bypassing Cloud NAT and removing NAT data-processing charges on that traffic.
Colocate chatty workloads in one region
Traffic between subnets in different regions bills per GB. Keeping services that talk to each other in the same region avoids inter-region egress.
Size secondary ranges for GKE deliberately
Secondary ranges are free but hard to change later. Plan Pod and Service ranges up front to avoid rebuilding a cluster, which is operationally expensive.
FAQ
Does a GCP subnetwork cost money?
No. The subnetwork, its primary and secondary IP ranges, and Private Google Access are free. Cost comes from the resources you place in it and the traffic they generate.
Is there a charge for reserving IP ranges in a subnet?
No. Defining CIDR ranges, including secondary ranges for GKE Pods and Services, is free. Static external IP addresses are a separate resource with their own charge.
How does a subnet affect my bill?
Indirectly, through the VMs in it and the traffic they send. Inter-zone and inter-region transfer and internet egress bill per GB. Enabling Private Google Access can cut Cloud NAT costs.
Related resources
google_compute_networkThe global VPC the subnetwork carves a regional range out of.
google_compute_instanceThe VMs that draw internal IPs from the subnet and generate its traffic.
google_compute_router_natThe NAT gateway a subnet's private VMs use, which Private Google Access can partly replace.
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 google_compute_subnetwork.