Changing the Default Region or Zone

This page explains how to set a default region or zone for your Google Cloud Console project.

When you make a request to Compute Engine, you might be required to provide a region or a zone depending on the specific requirements of your request. Any requests involving zonal resources requires that you supply a zone name and any requests involving regional resources requires that you supply a region name. For example, requests involving a VM instance always requires a zone specification and requests involving a static external IP address always requires a region specification.

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 attempts to pick a region and a zone that are close to where the project originated so that resources you create have reduced latency to your customers or clients. You can override the default zone and region for a project if you want to create resources in a different region or zone instead.

To learn more about regions and zones, read the Regions and Zone documentation.

To learn more about global, regional, and zonal Compute Engine resources, read the Global, Regional, and Zonal Resources documentation.

Before you begin

How a default region and zone affects your project

The default region and zone settings affect only client tools such as the gcloud command-line tool and the Google Cloud 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 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.

With the gcloud tool, you can omit the --zone and --region flags and the tool uses 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 the gcloud tool, or override it manually for each request in both the gcloud tool and the Cloud Console.

Looking up the default zone or region

The metadata server contains metadata information about a project, including the project ID, project name, and so on. You can query the metadata server to get and use information about the project.

If you specify a default region and zone for your project, then Compute Engine sets these values in the metadata server for your project.

Default regions and zones are set by using the following values:

  • google-compute-default-zone
  • google-compute-default-region

To see what your default region and zone settings are, run the following gcloud command:

gcloud compute project-info describe --project [PROJECT_ID]

where [PROJECT_ID] is your project ID.

Look for the default zone and region metadata values in the response. If the google-compute-default-region and google-compute-default-zone keys and values are missing from the response, that means no default zone or region is set.

Changing the default zone or region

Console

To change your default zone or region in the Cloud Console:

  1. In the Cloud Console, go to the Settings page.
  2. From the Region menu, select your default region.
  3. From the Zone menu, select your default zone.

gcloud

You can change the default zone and region in your metadata server by making a request to the metadata server. For example:

gcloud compute project-info add-metadata \
    --metadata google-compute-default-region=europe-west1,google-compute-default-zone=europe-west1-b

After you update the default metadata through any method, run gcloud init to reinitialize your default configuration. The gcloud command-line tool picks up the new default zone and region changes only after you rerun the gcloud init command.

For more information about gcloud options that can be used to set default zones and regions, review the setting default properties documentation.

What's next

Was this page helpful? Let us know how we did:

Send feedback about...

Compute Engine Documentation