All Google Compute Engine resources belong to a Google Developers 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:
When you specify your project ID, you need to include the full project ID,
including any domain if one is shown in your project ID. For example, when
gcloud compute, you can 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.
Generally, we recommend using the project ID to identify your projects because it is easier to remember than the numeric ID.
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
You can get information about a project, such as quota, name, ID, and so on,
by running the command
which returns information similar to the following:
$ 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 Developers 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 Developers 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 Developers 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 Developers Console:
- Go to the Metadata pane in the Developers Console.
- Click the Edit button and update the default zone and region values.