To use Google Cloud resources you have to enable the corresponding service API. This is forgotton, easily. Therefore, you’ve likely seen the ‘[service] API has not been used in project [project_number]..’ or ‘Consumer [project_number] should enable ..’ errors, and wondered how to find your project using a project number. Gladly, you can use the gcloud CLI for that.
Gcloud Projects Describe [Project Number]
To find your project, don’t use the cloud console (!), use the CLI:
gcloud projects describe [project_number]
And immediately, you receive all attributes required to update your infrastructure code: project id and name.
createTime: '2019-10-21T12:43:08.071Z'
lifecycleState: ACTIVE
name: your-project-name
parent:
id: 'your-organization-id'
type: organization
projectId: your-project-id
projectNumber: '000000000000'
Cloud Console Alternative
The project number is quite hidden in the Cloud Console. You might expect it in the Resource manager view. Sadly, at the time of writing, it’s only available in the Cloud Console Dashboard.
Please, however, don’t browse through all your projects. Save time and trouble by using the following url: <a href="https://console.cloud.google.com/home/dashboard?project=[project_number">https://console.cloud.google.com/home/dashboard?project=[project_number</a>]
. This will open the right project for you as well.
Conclusion
Finding project numbers is fast and easy with the gcloud CLI. Use the saved time and energy to resolve actual errors.
Photo by Thijs van der Weide from Pexels