All Google Compute Engine resources belong to a Google Cloud Platform project. Projects form the basis for enabling and using the Google Cloud Platform services, including managing APIs, enabling billing, adding and removing collaborators and enabling other Google services. Each project is a separate compartment and each resource belongs to exactly one such compartment. Projects can have different owners and users, are billed separately, and are managed separately.
After Google Compute Engine is enabled, any resources you create or use in Google Compute Engine belong to the project. Projects have some settings that apply broadly to resources contained in that project. For example, project-wide metadata applies to all virtual machine instances within a project. It is possible to have many projects with Google Compute Engine enabled. To differentiate between them, Google Compute Engine requires that you always identify the project you're working in when interacting with the Google Compute Engine service.
In order to interact with Google Compute Engine resources, you must provide
identifying project information for every request. If you are using
gcloud compute, you can save your project
ID so it is automatically provided, but in the API, you must always identify the
target project with each request.
A project can be identified two ways: using a project ID, or a project number. A project ID is the customized name you chose when you created the project, or when you activated an API that required you to create a project ID. A project number is automatically generated by the server. Both the project ID and project number can be found on the Dashboard of the project:
Both the project number and project ID are unique across Google Cloud Platform. If another user owns a project ID for their project, you won't be able to use the same project ID.
Note that a project ID is different than a project name. The project name is a human-readable way to identify your projects, but it is not used by any Google APIs. In this example, the project name is Example and the project ID is example-project-a.
gcloud, you can set a default project ID so that it is automatically
provided for each request. To set a default project ID, use the
gcloud config set command:
gcloud config set project example-project-a
When you choose your project ID (or any resource names), avoid providing sensitive information in your names.
Project team members
You can add users to your project as project team members. Project team members can collaborate on and access the project to varying degrees, depending on the level of access you grant them.
For more information, read about access control.
Getting project information
To get basic information about a project such as the project ID, project name, and project number, go to the Google Cloud Platform Console. Project information can be found on the Dashboard of the Cloud Platform Console.
- Project quotas
- Project ID, returned in the
- Any custom metadata for the project
gcloud and the API does not return the following information:
- The project number
- Project name ("My great project")
gcloud [--project PROJECT_ID] compute project-info describe
commonInstanceMetadata: fingerprint: 6GCr7A6I_3Y= items: - key: custom-metadata value: '1234' - key: ssh-keys value: 'user:ssh-rsa AAAAB3NzaC1yc2EA...' kind: compute#metadata creationTimestamp: '2013-09-06T10:36:53.505-07:00' description: '' id: '574734885120952459' kind: compute#project name: myproject quotas: - limit: 1000.0 metric: SNAPSHOTS usage: 0.0 - limit: 5.0 metric: NETWORKS usage: 1.0 - limit: 100.0 metric: FIREWALLS usage: 7.0 ... selfLink: https://www.googleapis.com/compute/v1/projects/myproject
Default region and zone
Currently, when you create a new project, Compute Engine automatically selects a default region and zone for the project, based on the location from where the project was created. Compute Engine makes a reasonable attempt to pick a region and zone that is the closest to where the project originated, so that resources you create will, ideally, have reduced latency to your customers or clients.
Compute Engine sets the default region and zone by setting two values in the project's metadata server. The metadata server contains metadata information about the project, including the project ID, project name, and so on. You can query the metadata server to get and use information about the project.
In the metadata server, the following two metadata values are set by default:
To see what your default region and zone settings are, run the following
gcloud command, replacing
PROJECT_ID with the
project that you want to get the information about. If you omit the project ID,
gcloud will use your default project.
gcloud compute project-info describe --project PROJECT_ID
Look for the default zone and region metadata values in the response.
How a default region and zone affects you
The default region and zone settings affect only client tools
and the Google Cloud Platform Console. Both of these tools use the default zone and region
information to help you manage resources more easily by automatically pre-selecting
the zone and region when you construct your requests.
In the Cloud Platform Console, zone and region fields are pre-populated when you create zonal or regional resources like instances and addresses. You can simply accept the pre-populated values, or explicitly change the value.
gcloud, you can omit the
--region flags and
the default zone and region properties for the project.
You can always change your default region and zone in the metadata server,
override the default zone and region locally for
gcloud, or override it
manually for each request in both
gcloud and the Google Cloud Platform Console.
Changing a default region or zone
To change a default region or zone in the metadata server in
Change your default zone and region in the metadata server
To change your default zone or region in the Cloud Platform Console:
- Go to the Metadata pane in the Cloud Platform Console.
- Click the Edit button and update the default zone and region values.