Cloud Cost Sense
Google Cloud Pub/Sub Cost: Throughput, Retention, and Egress
Estimate Google Cloud Pub/Sub cost from published and delivered bytes, subscriptions, request batching, message retention, and cross-region data transfer.
Count publish and delivery throughput separately
Pub/Sub charges for bytes published to a topic and bytes delivered from each subscription. Start with encoded message size, attributes, messages per month, and the number of subscriptions that receive each message. One published stream delivered to three subscriptions creates one publish path and three delivery paths, so subscriber fan-out can matter more than topic count.
Pub/Sub applies a minimum assessed size of 1,000 bytes to each publish, push, or pull request, even when its messages are smaller. Batch small messages into requests where latency requirements allow, and include message attributes rather than estimating only the payload. Use the current official pricing page for rates and free allowance instead of embedding a price that can change.
Add backlog, replay, and retention storage
Estimate how long subscribers normally take to acknowledge messages and how large the backlog becomes during an outage. Storage charges can apply to topic retention, retained acknowledged messages, snapshots, and unacknowledged messages held beyond the included period. A longer retention setting is not the same as average stored volume: calculate byte-hours from the backlog and retention pattern.
Topic retention can support replay for all attached subscriptions, while retaining acknowledged messages on each subscription can duplicate retained storage. Choose the recovery point your product actually needs, delete obsolete snapshots, and monitor the oldest unacknowledged message age. Redelivery also repeats subscriber work, so make consumers idempotent and tune acknowledgement handling before assuming exactly-once delivery will solve every duplicate.
Model regions, filters, and downstream services
Record where publishers, stored messages, and subscribers run. Pub/Sub can charge data transfer each time a message crosses a region boundary, and delivery to multiple remote subscribers is charged for each path. Keep tightly coupled producers and consumers in compatible locations when reliability and residency requirements allow, and validate message storage policies rather than assuming traffic stays in one region.
Filtered-out messages still incur throughput charges, so upstream routing can be cheaper than sending a broad stream to many heavily filtered subscriptions. Add the cost of subscriber compute, logging, retries, dead-letter processing, and destinations such as BigQuery or Cloud Storage to the architecture estimate. Compare normal traffic, a fan-out case, and a delayed-consumer case before launch.
Include Secret Manager rotation notifications in the workflow estimate