How do I choose a Google Storage bucket as a specific resource for a Cloud Run trigger?

Viewed 222

When I create a new Cloud Run trigger, I want to take the event storage.objects.create from a specific bucket. I have tried using:

  • bucket-name.
  • gs://bucket-name
  • //storage.googleapis.com/projects/_/buckets/bucket-name

My code is working with the Any resource option but I only need to listen to one bucket.

Cloud run trigger form

1 Answers

I understand your Cloud Run service is being triggered by a PubSub push. To specify the bucket that will notify the PubSub topic when a file is uploaded you can run:

gsutil notification create -t TOPIC_NAME -f json gs://BUCKET_NAME

Also here[1] [2] are some resources that explain all the full picture.

Related