Gcloud config

To avoid having to specify the zone or other parameters, you can set them in the config with:

$ gcloud config set compute/zone us-east1-d

And to unset them in the config, you can use the following:

$ gcloud config unset compute/zone

For a list of all the different settings available in the config, run gcloud config set --help.

The zone and region can be also stored in the environment variable CLOUDSDK_COMPUTE_ZONE and CLOUDSDK_COMPUTE_REGION. Environment variables override default properties that you set with the gcloud config commands, but do not override explicit flags like --zone or --region.

To set the environment variable CLOUDSDK_COMPUTE_ZONE, run or add this line to your .bashrc:

$ export CLOUDSDK_COMPUTE_ZONE=us-east1-c ...

Get Hands-On Machine Learning on Google Cloud Platform now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.