google_pubsub_subscription cost estimation
A Pub/Sub subscription is free to create. Cost comes from message throughput delivered, retained storage for unacked or replayable messages, and egress to the subscriber.
A google_pubsub_subscription attaches a consumer to a Pub/Sub topic, in pull or push form, and controls acknowledgment deadlines, retention, dead-letter policy, and ordering. Creating the subscription is free. Pub/Sub does not charge for having a subscription; it charges for the message data that moves through and is stored by it.
Throughput is the primary cost, billed per TiB of message data, and it is counted on both the publish side (into the topic) and the delivery side (out to each subscription). This matters: fan-out multiplies delivery. A topic with three subscriptions delivers each message three times, so three subscriptions on the same topic roughly triple the delivery throughput cost. The subscription is where that multiplication happens.
Two more cost drivers live on the subscription. Retained acknowledged messages and seek/replay retention are billed per GB-month of storage, so long retention windows on a high-volume subscription add up. And a push subscription to an endpoint in another region, or a subscriber that pulls across regions, incurs egress. c3x prices the delivery throughput, retained storage, and egress a subscription drives and links it to the topic it consumes.
Terraform example
A minimal but realistic configuration that C3X can estimate.
resource "google_pubsub_subscription" "worker" {
name = "worker-sub"
topic = google_pubsub_topic.events.id
ack_deadline_seconds = 20
message_retention_duration = "86400s"
retain_acked_messages = false
expiration_policy {
ttl = ""
}
}Pricing dimensions
What you actually pay for when you provision google_pubsub_subscription.
| Dimension | Unit | What's being charged |
|---|---|---|
| Subscription | free | Creating and holding a subscription has no charge. Cost is on the data that flows through it. $0 |
| Delivery throughput | per TiB | Message data delivered to the subscription, counted per subscription so fan-out multiplies it. ~$40/TiB delivered |
| Retained message storage | per GB-month | Storage for unacked messages, retained acked messages, and seek/replay retention windows. ~$0.27/GB-month |
| Egress to subscriber | per GB | Cross-region or internet egress when a push endpoint or puller is in another region. |
Optimization tips
Common ways to reduce google_pubsub_subscription cost without changing the workload.
Avoid unnecessary fan-out
Cuts duplicated delivery throughputEach subscription on a topic is billed for its own delivery throughput. Consolidating consumers that can share a subscription avoids paying to deliver the same messages multiple times.
Keep retention windows tight
Less retained-storage costLong message_retention_duration and retain_acked_messages hold data as billed storage. Set retention to the minimum replay window your consumers actually need.
Keep subscribers in the topic's region
A push endpoint or puller in another region adds egress on every message. Colocating the subscriber with the topic avoids cross-region transfer charges.
FAQ
Does a Pub/Sub subscription cost money?
Not to exist. Cost comes from message throughput delivered to it (per TiB), storage for retained or unacked messages (per GB-month), and egress if the subscriber is in another region.
Why do more subscriptions increase my Pub/Sub bill?
Throughput is counted per subscription on delivery. A topic with three subscriptions delivers each message three times, so fan-out multiplies the delivery throughput cost.
How do I estimate subscription cost?
Estimate messages delivered per month in TiB, the retained storage in GB, and any cross-region egress. c3x prices delivery throughput, retention, and egress and links the subscription to its topic.
Related resources
google_pubsub_topicThe topic the subscription consumes, where publish throughput is billed.
google_cloud_run_serviceA common push-subscription endpoint that carries its own compute cost.
google_bigquery_datasetA BigQuery subscription writes messages into a dataset that bills for storage.
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_pubsub_subscription.