[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["很难理解","hardToUnderstand","thumb-down"],["信息或示例代码不正确","incorrectInformationOrSampleCode","thumb-down"],["没有我需要的信息/示例","missingTheInformationSamplesINeed","thumb-down"],["翻译问题","translationIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-19。"],[],[],null,["# Cloud Storage subscriptions\n\nA Cloud Storage subscription is a type of export subscription\nthat writes messages to an existing Cloud Storage bucket as\nthey are received. You don't need to configure a separate subscriber client.\nUse the Google Cloud console, the Google Cloud CLI, the client libraries, or\nthe Pub/Sub API to create, update, list, detach, or delete a\nCloud Storage subscription.\n| **Key Point:** Understand the workflow for a Cloud Storage subscription and read about the permissions, properties, quotas, and pricing related to the subscription.\n\nWithout the Cloud Storage subscription type,\nyou need a pull or push subscription and a subscriber\n(such as Dataflow) that reads messages and writes them to\na Cloud Storage bucket. The overhead of running a\nDataflow job is not necessary when messages don't require\nadditional processing before storing them in a Cloud Storage bucket;\nyou can use a Cloud Storage subscription instead.\n\nHowever, a Dataflow pipeline is still recommended for\nPub/Sub systems where some data transformation is required\nbefore the data is stored in a Cloud Storage bucket.\n\nTo learn how to stream data from Pub/Sub to\nCloud Storage with transformation by using Dataflow,\nsee [Stream messages from Pub/Sub by using Dataflow](/pubsub/docs/stream-messages-dataflow).\n\nBefore you begin\n----------------\n\nBefore reading this document, ensure that you're familiar with the following:\n\n- How [Pub/Sub works](/pubsub/docs/overview) and the\n different Pub/Sub terms.\n\n- What are the different [kinds of subscriptions](/pubsub/docs/subscriber)\n and why you might want to use a Cloud Storage subscription.\n\n- How [Cloud Storage](/storage/docs) works.\n\n### Cloud Storage subscription workflow\n\nThe following image shows the workflow between a Cloud Storage\nsubscription and Cloud Storage.\n\n**Figure 1.** Workflow for a Cloud Storage subscription\n\nHere is a brief description of the workflow that references Figure 1:\n\n1. Pub/Sub uses the Cloud Storage API to send data\n to the Cloud Storage bucket. After a successful completion of a\n write operation, the API returns an `OK` response.\n\n2. The messages are sent in batches to the Cloud Storage bucket.\n A single batch corresponds to an [object](/storage/docs/objects) that is stored in the\n Cloud Storage bucket. You can configure the batch settings based on\n the object size and time elapsed since the object was created.\n\n3. The workflow to write an object to a Cloud Storage bucket requires\n two `OK` responses. The first `OK` response is sent when a message is\n successfully written to an object. The second `OK` response is sent when the\n object containing the message is finalized. A message only becomes visible\n in the bucket after the Cloud Storage object containing it has\n been successfully finalized.\n\n4. If there are any failures during the write operation, the\n Pub/Sub message itself is negatively acknowledged.\n The message is then re-sent. If the message write operation fails enough times and\n you have a dead letter topic configured on the subscription, then\n the message is moved to the dead letter topic.\n\n### Properties of a Cloud Storage subscription\n\nWhen you create a Cloud Storage subscription, you must specify\nsome additional properties. These properties include common subscription\nproperties, filename and format requirements, storage requirements and more.\nTo learn more about these properties, see [Cloud Storage subscription properties](/pubsub/docs/create-cloudstorage-subscription#subscription_properties).\n\n### Handle message failures\n\nWhen a Pub/Sub message cannot be written to a\nCloud Storage bucket, the message cannot be acknowledged.\nTo forward such undeliverable messages, configure a\n[dead-letter topic](/pubsub/docs/handling-failures#dead-letter_topic)\non the Cloud Storage subscription.\n\nIf Pub/Sub cannot write messages to Cloud Storage,\nthen Pub/Sub backs off delivery of messages in a way similar to\n[push backoff behavior](/pubsub/docs/push#push_backoff).\n\n### Quotas\n\nQuota limitations apply to the Cloud Storage subscriber throughput\nfor each region. For information about the quotas for Cloud Storage\nsubscriptions, see export subscriber quota limits in [Pub/Sub quotas and limits](/pubsub/quotas).\n\n### Pricing\n\nFor information about the pricing for Cloud Storage\nsubscriptions, see the [Pub/Sub pricing page](/pubsub/pricing#cloudstorage).\n\nWhat's next\n-----------\n\n- Create a [Cloud Storage subscription](/pubsub/docs/create-cloudstorage-subscription).\n- Troubleshoot a [Cloud Storage subscription](/pubsub/docs/cloudstorage-troubleshooting).\n\n- Explore Pub/Sub configuration tools:\n\n - [`gcloud` CLI commands](/sdk/gcloud/reference/pubsub/subscriptions)\n - [Pub/Sub APIs](/pubsub/docs/reference/service_apis_overview)\n - [Pub/Sub client libraries](/pubsub/docs/reference/libraries)"]]