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 request involving regional resources requires that you supply a region name, and any request involving zonal resources requires that you supply a zone name. For example, you must specify a region when you create a static external IP address, and you must specify a zone when you create a virtual machine (VM) instance.

When you create a project, Compute Engine automatically selects a default region and zone based on the location from which you create the project. Compute Engine attempts to pick a region and a zone that are close to where the project originates so that resources you create have reduced latency to your customers or clients. If you want to create resources in a different region or zone, you can override the default selection.

For more information about regions and zones, see Regions and zones.

For more information about global, regional, and zonal Compute Engine resources, see Global, regional, and zonal resources.

Before you begin

  • If you haven't already, set up authentication. Authentication is the process by which your identity is verified for access to Google Cloud services and APIs. To run code or samples from a local development environment, you can authenticate to Compute Engine as follows.

    Select the tab for how you plan to use the samples on this page:


    When you use the Google Cloud console to access Google Cloud services and APIs, you don't need to set up authentication.


    1. Install the Google Cloud CLI, then initialize it by running the following command:

      gcloud init
    2. Set a default region and zone.

How a default region and zone affect your project

The default region and zone settings affect only client tools, such as the Google Cloud CLI and the Google Cloud console. When you use these tools to construct your requests, the tools help you manage resources by automatically selecting the default region and zone.

When you use the Google Cloud console to create regional or zonal resources like addresses and instances, Compute Engine sets the region and zone fields for you. You can accept the pre-populated values or explicitly change one or both of the values.

When you use the gcloud CLI, omit setting the --region and --zone flags to use the default region and zone properties for the new project.

You can always change the default region and zone settings in the metadata server, override the default region and zone locally for the gcloud CLI, or override the settings manually for each request by using either the gcloud CLI or the Google Cloud console.

Looking up the default region or zone

The metadata server contains metadata information about a project, including the project ID and project name. 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-region
  • google-compute-default-zone

To see what your default region and zone settings are, run the following gcloud command, replacing PROJECT_ID with your project ID:

gcloud compute project-info describe --project PROJECT_ID

Look for the default region and zone 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 region or zone is set.

Changing the default region or zone

There are no restrictions on which regions or zones you can set for your default properties. For example, it is possible to set a default zone that is outside of your default region. Check the default region and zone settings when creating and managing your resources.


To change your default region or zone, follow these steps:

  1. In the Google Cloud console, go to the Settings page.

    Go to Settings

  2. From the Region drop-down menu, select a default region.

  3. From the Zone drop-down menu, select a default zone.

  4. Click Save.


You can change the default region and zone 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 by using any method, run the gcloud init command to reinitialize your default configuration. The gcloud CLI refreshes the default region and zone settings only after you run the gcloud init command.

For more information about using the gcloud CLI options to set default regions and zones, see Set default properties.

What's next