The cost of Pub/Sub has three components:
Pub/Sub service charges are based on usage (the number of published, delivered, or stored bytes).
Pub/Sub Lite throughput and storage charges, by contrast, are based on reserved capacity.
Data transfer charges for both services are based on usage, rather than reserved capacity.
PrerequisitesThis document requires that you understand the architecture of Pub/Sub or Pub/Sub Lite and the common terms that are part of each product. For more information, see Pub/Sub architecture.
Pricing examplesThe following table compares the monthly cost of Pub/Sub and Pub/Sub Lite systems for sample loads in North America. This example assumes a 24-hour message storage period, a 50% resource utilization for Pub/Sub Lite, and a pull or push subscription type for Pub/Sub. Other types of subscriptions might have additional costs.
Publish throughput in MiBps Number of subscriptions Zonal Lite topic Regional Lite topic Pub/Sub 10 1 $169 $608 $2,000 10 2 $214 $788 $3,000 100 1 $1,688 $6,075 $19,760 100 2 $2,138 $7,875 $29,640When you compare the cost of Pub/Sub and Pub/Sub Lite, consider the differences in features between the two products. For more information, see Choosing Pub/Sub or Pub/Sub Lite.
Pub/Sub service pricingThe pricing details in this section apply only to Pub/Sub and not Pub/Sub Lite. This section includes the following topics:
Throughput is the total number of bytes written (publish throughput) to a Pub/Sub topic or read (subscribe throughput) from a subscription to a topic over an interval of time.
Every calendar month, the first 10 GiB of throughput identified as the Message Delivery Basic SKU for a billing account is free. After that, the price is $40 per TiB in all Google Cloud regions. However, if you are using an import topic or an export subscription, read the next sections.
Throughput costs for BigQuery subscriptionsBigQuery subscriptions cost $50 per TiB in all Google Cloud regions for reading (subscribe throughput) from a subscription and writing to BigQuery. There are no additional BigQuery data ingestion charges. However, other types of BigQuery charges such as storage and data extraction apply. For more information, see BigQuery pricing. The first 10 GiB of BigQuery subscription throughput is not free.
Throughput costs for Cloud Storage subscriptionsCloud Storage subscriptions cost $50 per TiB in all Google Cloud regions for reading (subscribe throughput) from a subscription and writing to Cloud Storage. When a Cloud Storage subscriptions writes files to a bucket, other types of additional charges might apply. These include charges such as storage, retrieval, and replication. For more information, see Cloud Storage pricing. The first 10 GiB of Cloud Storage subscription throughput is not free.
Throughput costs for import topicsImport topics (for Kinesis Data Streams) cost $50 per TiB in all Google Cloud regions for ingesting data into Pub/Sub (publish throughput).
Import topics (for Cloud Storage, Azure Event Hubs, AWS MSK, or Confluent Cloud) cost $80 per TiB in all Google Cloud regions for ingesting data into Pub/Sub (publish throughput).
When an import topic ingests data into a Pub/Sub topic, other types of source-specific additional charges might apply. These include charges such as egress from AWS for Kinesis Data Streams source, Cloud Storage operation charges for Cloud Storage source. The first 10 GiB of import topics throughput is not free.
Message volume calculationThe data volume of a message is the sum of the sizes of the following message attributes:
message_id
stringA minimum of 1 KB is assessed for each request, independent of the message sizes in the request. Hence, for messages smaller than 1 KB, it is cheaper to batch multiple messages in a single request.
Storage costsStorage costs of $0.27 per GiB-month are charged for the following:
A subscription is configured with message retention duration of over 1 day and has backlog that is over 1 day old. In this case, storage fees are charged for unacknowledged messages older than 1 day. No additional charge is incurred for unacknowledged messages that are already retained by the subscription's topic (if the subscription's topic is configured to retain messages).
Consider a topic without message retention enabled and an attached subscription with message retention duration set to the default of 7 days. If subscribers are able to process the messages within 1 day of publishing, subscription owners are not charged storage fees for unacknowledged messages. However, storage fees are incurred for unacknowledged messages retained over 1 day of publishing if subscribers are unable to process the messages within the first 24 hours.
Consider a topic with message retention duration set to 4 days and an attached subscription with message retention duration set to the default of 7 days. Subscription owners are not charged storage fees for unacknowledged messages retained for less than 4 days of publishing, since those messages are already retained by the topic. If subscribers are unable to process the messages after 4 days of publishing, subscription owners are charged for the additional 3 days.
Retaining acknowledged messages in individual subscriptions offers the most flexibility to subscription owners, but is usually the most expensive storage mechanism. The least expensive storage mechanism is topic message retention because messages retained for a topic can be used across all attached subscriptions without additional fees per subscription. Pub/Sub does not charge subscription owners for retained unacknowledged messages if those messages are already retained by the topic. Snapshots can also be an economical option because a single snapshot can be used across multiple subscriptions.
Note that if the topic's message retention settings are changed, charges on unacknowledged messages might change as well. For example, subscription owners might begin to incur storage charges on unacknowledged messages if the topic owner disables message retention.
Single Message Transform CostsUDFs SMT costs represent the total amount of data processed using a Pub/Sub topic SMT or a Pub/Sub subscription SMT. Data processing charges are based on the larger of the input and output message sizes. For instance, if a UDF SMT transforms a 5MB message into an 8MB message, the data processing costs will be calculated based on 8MB.
The price is $40 per TiB in all Google Cloud regions.
Data transfer costsThe fees for internet data transfer and message delivery between Google Cloud regions are consistent with the VPC network rates, with the following exceptions:
There are no zone data transfer fees for Pub/Sub usage.
Egress to Google products is not exempt from data transfer fees.
You don't pay for data transfer into Pub/Sub. For example, if the publisher is in a different region or zone, you must pay data transfer fees for the originating service, but no inbound data transfer fees is required. Similarly, if the publisher is publishing from Amazon Web Service (AWS) or a private data center, then you don't have to pay data transfer fees to Pub/Sub.
If you use export subscriptions to write data to destinations such as multi-region BigQuery tables, or dual-region or multi-region Cloud Storage buckets, data transfer costs apply only in the following situations:
Publishing outside the regions of a destination resource: If publishers send data to a region outside of the regions covered by the multi-region or dual-region resource, data transfer costs apply to all data.
Optimized routing: If publishers send data to a region within the destination resource's regions, data transfer costs apply only to data that Pub/Sub routes to a different region for optimized delivery. This optimized routing only occurs in exceptional circumstances.
You are charged for data transfer every time a message crosses a region boundary. If you have several subscribers in a region different from the region where messages are stored, you are charged data transfer fees independently for delivery to each subscriber.
Data transfer costs due to message storage policyA message storage policy can result in additional region data transfer fees if the policy forces the data to exit a Google Cloud region. For example, consider a message with the following events:
In this case, the billing scenario is explained as follows:
The project that contains the topic is charged a data transfer fee only if the published message is stored in a region different from the region where the message was published (that is, B is actually a different region from A). The project containing the subscription is charged a data transfer fee only if the published message is stored in a different region from the subscriber client is (C is not the same as B).
Filtered messages costsPub/Sub automatically acknowledges the messages that don't match a filter, but you still incur throughput fees for these messages. There are no data transfer fees for filtered messages.
The 1,000-byte minimum doesn't apply to the messages that the Pub/Sub service automatically acknowledges. Message delivery fees are based on the number of bytes in these messages, and is independent of the small size of the messages.
Cross-project Pub/Sub billingIf you use Pub/Sub across projects, Pub/Sub fees are billed to the project that contains the requested resource:
For example, if the subscription lives in project A, then project A is billed for data that is pulled from the subscription, even if the subscription is attached to a topic in project B.
If an authorized service account in project A consumes messages from a subscription in project B, then project B is billed for the data that is pulled from the subscription.
Pub/Sub Lite service pricing Note: Pub/Sub Lite is deprecated. Effective March 18, 2026, Pub/Sub Lite will be turned down.You can migrate your Pub/Sub Lite service to Google Cloud Managed Service for Apache Kafka or Pub/Sub.
The following pricing details apply only to Pub/Sub Lite, not Pub/Sub. Unless otherwise specified, the details apply to both zonal and regional Lite topics. The following sections are included:
Throughput costsThroughput is the total number of bytes written (publish throughput) to a Pub/Sub Lite topic or read (subscribe throughput) from a subscription to a topic over an interval of time.
Pub/Sub Lite throughput fees are based on the provisioned or reserved throughput capacity, rather than the actual throughput (MiBps) or the total number of bytes in a billing period (MiB per month). Throughput capacity is provisioned and priced in capacity units. You can provision throughput capacity for one or more topics in the same region by using a Lite reservation.
The following table shows the costs for throughput and storage for a Pub/Sub Lite system.
Throughput with a Lite reservationLite reservations are a way to reserve and share throughput capacity among one or multiple topics in a region. Lite reservations are required for regional Pub/Sub Lite topics.
Throughput capacity for Lite reservations is measured in capacity units. You can provision only a whole number of capacity units for a reservation. Throughput of different operations require a different number of capacity units, as described in the following table:
Capacity units required Zonal Lite topic Regional Lite topic 1 MiBps of publish throughput 1 capacity unit 4 capacity units 1 MiBps of subscribe throughput 0.5 capacity units 2 capacity units If you are using the Kafka wire protocol to publish messages, you require an additional 1 capacity unit for every 1 MiBps of publish throughput and an additional 0.5 capacity units for every 1 MiBps of subscribe throughput. This throughput consumption is in addition to the consumption of capacity units due to the topic throughput.The number of partitions across all Lite topics in a reservation must be no greater than the number of capacity units reserved.
Calculate the cost of throughput capacity for a single topic with reservationsThe following section helps you to calculate the cost of throughput capacity for a single zonal Lite topic that uses reservations:
For the same throughput with a regional Lite topic with 5 partitions, you require a reservation with 40 capacity units, 20 for publish throughput and 20 for subscribe throughput.
You can change the number of capacity units in a reservation at any time. However, you are billed for the maximum capacity provisioned in the last 24 hours. For example, if you change the capacity of a reservation from 40 to 10 capacity units at 10:00 AM on Monday, you are billed for 40 capacity units per hour until 10:00 AM on Tuesday and for 10 capacity units per hour afterwards.
Note that the capacity of a reservation can be used for publish and subscribe throughput with any topic in the same region as the reservation. To learn more about reservations, see Create and manage Lite reservations.
Throughput without a Lite reservationThis section applies to zonal Lite topics only.
You can choose to not use reservations and reserve publish and subscribe throughput capacity for a single topic. In this case, you are billed for the currently reserved capacity rather than the maximum over a running 24-hour window.
Note that capacity configured without reservations must be between the following limits:
The following section helps you to calculate the cost of throughput capacity for a single zonal Lite topic that does not use reservations:
As with Lite throughput, you pay for the storage capacity of a topic. Pub/Sub Lite charges for the maximum amount of storage that you provision in a month. Each partition must have at least 30 GiB of storage capacity.
A regional Lite topic stores data in two zones in a region, whereas a zonal LLite topic stores data only in one zone in a region. Regional Lite topics use two bytes of storage for every byte of messages published. Therefore, the storage cost per byte published to a regional Lite topic is double the cost for a zonal one.
To estimate storage capacity for a Pub/Sub Lite system, refer to the following list:
Determine the length of time you require to store messages.
To estimate the total storage required, multiply your average expected throughput for each partition by the length of time needed to store your messages. For example, to publish 40 MiB of messages per second across 10 partitions in a zonal Lite topic and to retain messages for one day, provision 3375 GiB of storage (equivalent to 40 MiBps * 3600 secs per hour * 24 hrs per day * 1 GiB/1024 MiB). The storage costs you $135 in North America (equivalent to 3375 GiB * 24 hours per day * 30 days per month * $0.04 / GiB-month-zone). For a regional Lite topic, since the data is stored in two zones, the storage cost is doubled to $270.
Consider uneven key distribution.
All partitions are allocated the same storage capacity. If you expect some partitions to have a larger volume than others, provision all partitions to have the storage required for the largest partition.
When computing the size of messages for throughput and storage, each message uses a minimum of 256 bytes. If the message is larger than 256 bytes, then the size of the message is the sum of the following message attributes:
Pub/Sub Lite data transfer fees apply only if your subscribers are in a different zone or region from the location of the topic. The fees for internet data transfer out and message delivery between Google Cloud regions are consistent with the VPC network rates, with the following exceptions:
For regional Lite topics with subscribers in the same region as the topic, there are no zone data transfer fees.
Data transfer to Google products is not exempt from data transfer fees.
If you pay in a currency other than USD, the prices listed in your currency on Google Cloud SKUS apply. The rate listed is per TiB (2^40 bytes, or approximately 1.1 trillion bytes).
What's nextCheck out Pub/Sub quotas and limits or Pub/Sub Lite quotas and limits.
Calculate your Pub/Sub costs using the pricing calculator.
Refer to the Pub/Sub SKU groups.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4