Google Cloud Pub/Sub is priced by measuring the number of operations as well as storage and networking. Note that in Google Cloud Pub/Sub, billing is charged to the project that contains the requested resource.
When charging in local currency, Google will convert the prices listed into applicable local currency pursuant to the conversion rates published by leading financial institutions.
Google Cloud Pub/Sub Pricing
To help you scale up cost-effectively, with no upfront commitment, and no forecast for future usage, we offer tiered pricing. As your usage of Google Cloud Pub/Sub increases, the price decreases, as described below:
|Usage Per Month||Price/Million|
|First 250M Operations||$0.40|
|Next 500M Operations||$0.20|
|Next 1,000M Operations||$0.10|
|Beyond 1,750M Operations||$0.05|
There are no setup fees, and no fees to create or maintain topics or subscriptions.
Every API call is an operation. Calls containing a message over 64kB will incur additional operations. You are charged in units of 64kB. Each message over 64kB (with payload and labels combined) will be accounted for as multiple operations. Each 64kB of the message, or a fraction thereof, will count as 1 operation. Batched calls are accounted for as multiple operations.
Current Google Cloud Storage Standard fees apply to subscription backlogs, which are sampled on a regular basis:
|Subscription backlogs||$0.026 (GB-month)|
Current Google Compute Engine networking fees apply to messages that are delivered outside the region that message was originally published in. Like other Google Cloud Platform services, no Google Compute Engine networking fees apply when publishers and subscribers are in different zones within the same region, nor for ingress from the Internet.
Suppose you have the following usage pattern during a 30-day month:
- A topic that is used to publish 10 million messages.
- A pull subscription in the same project.
- A push subscription in a different project.
If each of your messages were less than or equal to 64kB, each one would incur at least 3 operations:
- Two API calls to create the topic and subscription.
- 10M publish operations.
- 10M pull responses (assuming that every single
pull()call returns a pending message—empty responses would also add to this total).
- 10M acknowledgments.
That will cost $12, because all 30M calls fall into the $0.40 price level.
The second project with the push subscription only pays $4 for 10M push notifications (a 200 OK response replaces acknowledgement operations).
As stated above, you are charged in units of 64kB. For example, if your messages were 100kB, you would incur an additional 10M publish and 10M pull response operations, bringing the cost up to US$20 (50M * $0.40/M). The second project would also pay $4 more, for an additional 10M push operations.
If instead you published 1 billion messages per month, and added a second pull subscription, that would bring you to 4,000M operations, costing a total of $412.50:
Ordinarily, data is delivered to subscribers and consumed quickly enough that very little backlog accumulates. However, if the second project crashed over a long weekend, what might 3 days of failed push delivery attempts cost? Assuming that 1M messages were published during the incident, you would incur:
- Additional 2-5M push delivery attempts, plus another operation for each additional 64kB for $5
- Storing up to 1M messages for up to 3 days. With 100kB messages, that would add up to a total of 10 GB-months, or $0.26
If Google Cloud Pub/Sub were mainly being used to connect Google Cloud Platform resources within, say, the US-Central region there would be no networking fees incurred by that project. However, if you were pushing to an App Engine project residing in the European Union, that would also incur $175 in inter-regional networking fees from North America to Europe, for 1000GB for 10M messages of 100kB each as well as up to 500GB of attempted deliveries in the downtime scenario:
For a complete, authoritative list of Pub/Sub prices see Cloud Platform SKUS.