Stay organized with collections Save and categorize content based on your preferences.
gcloud storage buckets notifications create
URL
[--custom-attributes
=[KEY
=VALUE
,…], -m
[KEY
=VALUE
,…]] [--event-types
=[NOTIFICATION_EVENT_TYPE
,…], -e
[NOTIFICATION_EVENT_TYPE
,…]] [--object-prefix
=OBJECT_PREFIX
, -p
OBJECT_PREFIX
] [--payload-format
=PAYLOAD_FORMAT
, -f
PAYLOAD_FORMAT
; default="json"] [--skip-topic-setup
, -s
] [--topic
=TOPIC
, -t
TOPIC
] [GCLOUD_WIDE_FLAG …
]
gcloud storage buckets notifications create
creates a notification configuration on a bucket, establishing a flow of event notifications from Cloud Storage to a Cloud Pub/Sub topic. As part of creating this flow, it also verifies that the destination Cloud Pub/Sub topic exists, creating it if necessary, and verifies that the Cloud Storage bucket has permission to publish events to that topic, granting the permission if necessary.
If a destination Cloud Pub/Sub topic is not specified with the -t
flag, Cloud Storage chooses a topic name in the default project whose ID is the same as the bucket name. For example, if the default project ID specified is default-project
and the bucket being configured is gs://example-bucket
, the create command uses the Cloud Pub/Sub topic projects/default-project/topics/example-bucket
.
In order to enable notifications, your project's Cloud Storage service agent must have the IAM permission "pubsub.topics.publish". This command checks to see if the destination Cloud Pub/Sub topic grants the service agent this permission. If not, the create command attempts to grant it.
A bucket can have up to 100 total notification configurations and up to 10 notification configurations set to trigger for a specific event.
example-bucket
to the Cloud Pub/Sub topic projects/default-project/topics/example-bucket
:
gcloud storage buckets notifications create gs://example-bucket
The same as the above but sends no notification payload:
gcloud storage buckets notifications create --payload-format=none gs://example-bucket
Include custom metadata in notification payloads:
gcloud storage buckets notifications create --custom-attributes=key1:value1,key2:value2 gs://example-bucket
Create a notification configuration that only sends an event when a new object has been created or an object is deleted:
gcloud storage buckets notifications create --event-types=OBJECT_FINALIZE,OBJECT_DELETE gs://example-bucket
Create a topic and notification configuration that sends events only when they affect objects with the prefix photos/
:
gcloud storage buckets notifications create --object-prefix=photos/ gs://example-bucket
Specifies the destination topic ID files-to-process
in the default project:
gcloud storage buckets notifications create --topic=files-to-process gs://example-bucket
The same as above but specifies a Cloud Pub/Sub topic belonging to the specific cloud project example-project
:
gcloud storage buckets notifications create --topic=projects/example-project/topics/files-to-process gs://example-bucket
Skip creating a topic when creating the notification configuraiton:
gcloud storage buckets notifications create --skip-topic-setup gs://example-bucket
URL
--custom-attributes
=[KEY
=VALUE
,…], -m
[KEY
=VALUE
,…]
--event-types
=[NOTIFICATION_EVENT_TYPE
,…], -e
[NOTIFICATION_EVENT_TYPE
,…]
NOTIFICATION_EVENT_TYPE
must be one of: OBJECT_ARCHIVE
, OBJECT_DELETE
, OBJECT_FINALIZE
, OBJECT_METADATA_UPDATE
.
--object-prefix
=OBJECT_PREFIX
, -p
OBJECT_PREFIX
--payload-format
=PAYLOAD_FORMAT
, -f
PAYLOAD_FORMAT
; default="json"
PAYLOAD_FORMAT
must be one of: json
, none
.
--skip-topic-setup
, -s
--topic
=TOPIC
, -t
TOPIC
--access-token-file
, --account
, --billing-project
, --configuration
, --flags-file
, --flatten
, --format
, --help
, --impersonate-service-account
, --log-http
, --project
, --quiet
, --trace-token
, --user-output-enabled
, --verbosity
.
Run $ gcloud help
for details.
gcloud alpha storage buckets notifications create
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-05-07 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-05-07 UTC."],[],[]]
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.5