Google CloudCloud Load BalancingNetworking

google_compute_url_map cost estimation

A URL map is free. It routes requests by host and path to backend services. The Cloud Load Balancing charge sits on the forwarding rule and data processed.

A google_compute_url_map is the request-routing rulebook of an HTTP(S) load balancer. It maps incoming host headers and URL paths to backend services or backend buckets, and can rewrite headers, redirect, and mirror traffic. The URL map is free. There is no charge for the map, for the number of host or path rules, or for the requests it routes.

Its cost relevance is that it lets one load balancer serve many services. Because a single URL map can fan a single forwarding rule out to many backends, it is the mechanism that lets you avoid running a separate load balancer per service. The Cloud Load Balancing charge stays on the one forwarding rule (hourly plus data processed) rather than multiplying, so a well-structured URL map is a cost-saving pattern, not a cost.

The real cost sits downstream: the forwarding rule and target proxy that reference the URL map carry the load balancer charge, and the backend services it routes to carry the backend compute and egress. c3x prices the forwarding rule and backends and treats the URL map, along with the proxy and health checks, as the free routing config it is.

Terraform example

A minimal but realistic configuration that C3X can estimate.

resource "google_compute_url_map" "app" {
  name            = "app-urlmap"
  default_service = google_compute_backend_service.web.id

  host_rule {
    hosts        = ["api.example.com"]
    path_matcher = "api"
  }

  path_matcher {
    name            = "api"
    default_service = google_compute_backend_service.api.id
  }
}

Pricing dimensions

What you actually pay for when you provision google_compute_url_map.

DimensionUnitWhat's being charged
URL mapfreeThe URL map, its host and path rules, and the requests it routes have no charge.
$0
Forwarding rule it frontsper hour + per GBThe load balancer the URL map routes for bills on the forwarding rule plus data processed.
~$0.025/hour per rule + data
Backend services it routes toper hourThe backends the URL map fans out to carry their own compute and egress cost.

Optimization tips

Common ways to reduce google_compute_url_map cost without changing the workload.

Fan out one load balancer to many services

One load balancer instead of many

Use host and path rules to route several services through a single forwarding rule. This keeps you on one hourly load-balancer charge instead of one per service.

Route static paths to a backend bucket

Sending static asset paths to a backend bucket (Cloud Storage) instead of a VM backend offloads that traffic to cheaper object storage and CDN.

Use redirects at the load balancer, not a VM

URL map redirect actions handle HTTP-to-HTTPS and host redirects for free, avoiding a small always-on VM whose only job is redirecting.

FAQ

Does a URL map cost money?

No. The URL map is free routing config, with no charge for host or path rules or the requests it routes. Cost sits on the forwarding rule and the backend services it points at.

Can a URL map reduce my load balancer cost?

Yes, structurally. By routing many services through one forwarding rule, a URL map lets you run a single load balancer instead of one per service, keeping you on one hourly charge.

How do I estimate the cost behind a URL map?

Price the forwarding rule (hourly plus data processed) and the backend services it routes to. c3x does this and treats the URL map, proxy, and health checks as 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 google_compute_url_map.