How to determine GCP project of a GCS bucket

Photo by Sixteen Miles Out on Unsplash

The Problem Statement

When there are any issues with a GCS (google cloud storage) bucket in GCP (google cloud platform), our teams / SREs / executives would almost always know (either or all of) the following info about the bucket:

  • bucket name
  • public URL
  • authenticated URL
  • gsutil URL
  • etc etc

However, from these info, it’s not clear which GCP project (out of the gazillion GCP projects in an organization account) owns the specific bucket.

The Solution

Step 1: Determine projectNumber
using the bucket API explorer
> Just add the bucket name into the bucket field of the form and leave everything else default as it is.

Step 2: Determine PROJECT_ID
using the ‘gcloud projects list’ command

gcloud projects list --filter="projectNumber:<PROJECT_NUMBER>"

Thus, you can find out the PROJECT_ID / PROJECT_NAME of the GCS bucket.




Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Syed Rakib Al Hasan

DevOps Engineer, Backend Developer, Cloud Architect, Night time drive-outs & nice hangouts