Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get project name/id from Google Cloud Storage bucket?

I'm given a Google Cloud Storage bucket address (gs://some_bucket_name) to which I've already been granted read access. The bucket belongs to another project. Is there any way for me to find out what the project name or id that the bucket belongs to?

like image 354
nwly Avatar asked Mar 05 '19 19:03

nwly


People also ask

What is Google project ID?

A project ID is a unique string used to differentiate your project from all others in Google Cloud. You can use the Google Cloud console to generate a project ID, or you can choose your own. You can only modify the project ID when you're creating the project.


1 Answers

A good question.

Buckets don't have obvious scoping to projects and their globally unique names aren't presented as part of hierarchy that includes project identifiers.

However... acls may be a good bet... I'm not certain that this definitive, please check:

gsutil acl get gs://[[BUCKET-NAME]]

Which yields the projectNumber:

[
  {
    "entity": "project-owners-123456789012",
    "projectTeam": {
      "projectNumber": "123456789012",
      "team": "owners"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-editors-123456789012",
    "projectTeam": {
      "projectNumber": "123456789012",
      "team": "editors"
    },
    "role": "OWNER"
  },
  {
    "entity": "project-viewers-123456789012",
    "projectTeam": {
      "projectNumber": "123456789012",
      "team": "viewers"
    },
    "role": "READER"
  }
]
like image 156
DazWilkin Avatar answered Sep 21 '22 05:09

DazWilkin