All Google Compute Engine resources belong to a Google Cloud Platform Console 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 totally compartmentalized world. Projects do not share resources, 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. 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 for each request, but in the API, you must
always specify the project ID.
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 a unique number assigned to your project. Both the project ID and project number can be found on the Dashboard of the project:
Note that a project ID is different than the 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.
When you provide your project ID, include the full project ID, with a
domain if one is shown in the console. For example, when using
gcloud compute, specify your
project ID like so:
$ gcloud --project example.com:my-project compute instances create example-instance
gcloud lets you save your project ID so that it is automatically provided for
each request. To set a default project, use the
gcloud config set
$ gcloud config set project example.com:my-project
When you choose your project ID (or any resource names), avoid providing sensitive information in your names.
Project team members
Projects have team members that can collaborate on and access the project to varying degrees. Team members can be added as an owner, editor, or viewer. Every project can have one or more owners, editors, and viewers. Depending on their role, team members can access Google Compute Engine resources for that project accordingly:
- To add or modify Google Compute Engine resources in a project, you need to be an owner or editor of that project.
- To list information about certain resources within a project, you need to be a viewer, owner, or editor of that project.
To add team members to a project, see managing project members.
Get project information
To get key 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 information like:
- 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: sshKeys 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 two metadata values that are set include:
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. You can also omit the project
gcloud uses 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.