Cloud Storage subscriptions

A Cloud Storage subscription is a type of export subscriptionthat writes messages to an existing Cloud Storage bucket asthey are received. You don't need to configure a separate subscriber client.Use the Google Cloud console, the Google Cloud CLI, the client libraries, orthe Pub/Sub API to create, update, list, detach, or delete aCloud Storage subscription.

Key Point: Understand the workflow for a Cloud Storage subscription andread about the permissions, properties, quotas, and pricing related tothe subscription.

Without the Cloud Storage subscription type,you need a pull or push subscription and a subscriber(such as Dataflow) that reads messages and writes them toa Cloud Storage bucket. The overhead of running aDataflow job is not necessary when messages don't requireadditional processing before storing them in a Cloud Storage bucket;you can use a Cloud Storage subscription instead.

However, a Dataflow pipeline is still recommended forPub/Sub systems where some data transformation is requiredbefore the data is stored in a Cloud Storage bucket.

To learn how to stream data from Pub/Sub toCloud Storage with transformation by using Dataflow,seeStream messages from Pub/Sub by using Dataflow.

Before you begin

Before reading this document, ensure that you're familiar with the following:

Cloud Storage subscription workflow

The following image shows the workflow between a Cloud Storagesubscription and Cloud Storage.

Flow of messages for a Cloud Storage subscription

Figure 1. Workflow for a Cloud Storage subscription

Here is a brief description of the workflow that references Figure 1:

  1. Pub/Sub uses the Cloud Storage API to send datato the Cloud Storage bucket. After a successful completion of awrite operation, the API returns anOK response.

  2. The messages are sent in batches to the Cloud Storage bucket.A single batch corresponds to anobject that is stored in theCloud Storage bucket. You can configure the batch settings based onthe object size and time elapsed since the object was created.

  3. The workflow to write an object to a Cloud Storage bucket requirestwoOK responses. The firstOK response is sent when a message issuccessfully written to an object. The secondOK response is sent when theobject containing the message is finalized. A message only becomes visiblein the bucket after the Cloud Storage object containing it hasbeen successfully finalized.

  4. If there are any failures during the write operation, thePub/Sub message itself is negatively acknowledged.The message is then re-sent. If the message write operation fails enough times andyou have a dead letter topic configured on the subscription, thenthe message is moved to the dead letter topic.

Properties of a Cloud Storage subscription

When you create a Cloud Storage subscription, you must specifysome additional properties. These properties include common subscriptionproperties, filename and format requirements, storage requirements and more.To learn more about these properties, seeCloud Storage subscription properties.

Handle message failures

When a Pub/Sub message cannot be written to aCloud Storage bucket, the message cannot be acknowledged.To forward such undeliverable messages, configure adead-letter topicon the Cloud Storage subscription.

If Pub/Sub cannot write messages to Cloud Storage,then Pub/Sub backs off delivery of messages in a way similar topush backoff behavior.

Quotas

Quota limitations apply to the Cloud Storage subscriber throughputfor each region. For information about the quotas for Cloud Storagesubscriptions, see export subscriber quota limits inPub/Sub quotas and limits.

Pricing

For information about the pricing for Cloud Storagesubscriptions, see thePub/Sub pricing page.

What's next

Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2026-02-19 UTC.