What is a property?
Properties are settings that govern the behavior of the gcloud CLI and other SDK tools.
Properties can be used to define a per-product or per-service setting such as the account used by the gcloud CLI and other Cloud SDK tools for authorization, the default region to be used when working with Google Compute Engine resources, or even the option to turn off automatic Cloud SDK component updates. Properties can also be used to define gcloud command-line tool preferences like verbosity level and prompt configuration for gcloud CLI commands.
Properties and flags
The gcloud CLI supports some global flags and command flags
that have the same effect as SDK properties. For example, the gcloud CLI supports both
--project flag and
project property. Properties allow you to maintain
the same settings across command executions while flags affect command behavior
on a per-invocation basis. Note that flags override properties when both
A configuration is a named set of SDK
properties. The gcloud CLI uses a configuration named
default as the initial active
default is suitable for most use cases. However, you can also
create additional configurations and switch between them as required.
gcloud config list
The gcloud CLI returns the list of properties:
[compute] region = us-east1 zone = us-east1-d [core] account = firstname.lastname@example.org disable_usage_reporting = False project = example-project [metrics] command_name = gcloud.config.list
To set a property in the active configuration, run
gcloud config set:
gcloud config set project [PROJECT]
To set properties that are not in the
properties section, you must specify the section followed by a forward slash
before the property name:
gcloud config set compute/zone us-east1-b
Setting properties via environment variables
You can also set properties via environment variables. Each property has a
corresponding environment variable that can be used to set it. The name of the
environment variable follows the
For example, you can set the
compute/zone properties as
To unset a property in the active configuration, use
gcloud config unset:
gcloud config unset disable_usage_reporting
- Read SDK Configurations to learn more about configurations.