Search code examples
google-cloud-storagegoogle-cloud-console

How to grant multiple appengine projects access to the same Cloud Storage bucket?


Google Cloud console allows creating buckets from inside a project and edit the Access Control List. I created a bucket, bucket-foo from one of my apps app1

Now I would like to use the same bucket inside another app2. I am unable to figure out how to allow app2 access to the same bucket that I created under app1.


Solution

  • You can add app2's service account to the bucket's ACL list to allow the app access to the bucket.

    First you need to find the app's service account name, which is listed in the Application Settings page in the Admin Console, but it's also just <app-id>@appspot.gservicaccount.com

    Then add that that account to the ACL for bucket-foo using gsutil acl ch, by adding app2's service account to the ACL list.

    In the end it'll probably be something like this:

    gsutil acl ch -u -R [email protected]:WRITE gs://bucket-foo