Skip to content

Get project name of GCS bucket


Sometimes when you are managing many GCS buckets - You may lose the project they exist in.

If you aren't using a swanky naming convention like <proj-name>-<name> then this is for you.


We are able to use the GCS API to get information about the bucket.

Required permissions

As this is using the GCP API, you will have to at least have the below permissions/roles

  • storage.buckets.get
  • storage.buckets.list
  • View access on the project

Get project Number

curl -X GET \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "<>" | jq ."projectNumber"

Convert number to project name

gcloud projects describe --format json | jq .name


# Get the project number
curl -X GET \
  -H "Authorization: Bearer $(gcloud auth print-access-token)" \
  "" | jq ."projectNumber"
# Get the project Name
gcloud projects describe 255964991331 --format json | jq .name

Want to make this site better? Open a PR or help fund hosting costs