I have a service account that has Storage Admin role. When I try to use client.lookup_bucket('xyz')
I get the following access error:
google.api_core.exceptions.Forbidden: 403 GET https://storage.googleapis.com/storage/v1/b/xyz?projection=noAcl: <svc_account> does not have storage.buckets.get access to the Google Cloud Storage bucket.
xyz
is a bucket that does not exist. I am able to access an existing bucket. But according to documentation - lookup_bucket will get a bucket by name, returning None if not found.
Can anyone tell me why I get the Forbidden error even though I have Storage Admin role (I even tried Owner role for the entire project and I still get the same error)
xyz
, you will get permission error 403. My comment is, do you own the bucket? If not, do not make assumptions that someone else does not already own it. Look at Samuel's answer below to determine if the bucket name is available. – John Hanley