Linux command
gcloud-config-set 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Set default project
gcloud config set project [project-id]
Set default region
gcloud config set compute/region [us-central1]
Set default zone
gcloud config set compute/zone [us-central1-a]
Set account
gcloud config set account [email@example.com]
Disable usage reporting
gcloud config set disable_usage_reporting true
说明
gcloud config set assigns values to gcloud configuration properties, establishing defaults that apply to all subsequent gcloud commands. This eliminates repetitive specification of common parameters like project ID, region, and zone. Properties follow a hierarchical naming scheme, with some scoped to specific services (like compute/region for Compute Engine operations) and others applying globally (like project). The command validates property names but may not immediately validate values, which could lead to errors in future commands if invalid. Command-line flags always take precedence over configured properties, allowing temporary overrides without changing stored configuration. Properties are saved to the active configuration, so switching configurations changes the effective property values. This property-based system is central to efficient gcloud usage, particularly for users managing resources across multiple zones or projects.
参数
- project
- Default project ID.
- compute/region
- Default Compute region.
- compute/zone
- Default Compute zone.
- account
- Active account.
- --help
- Display help information.
FAQ
What is the gcloud-config-set command used for?
gcloud config set assigns values to gcloud configuration properties, establishing defaults that apply to all subsequent gcloud commands. This eliminates repetitive specification of common parameters like project ID, region, and zone. Properties follow a hierarchical naming scheme, with some scoped to specific services (like compute/region for Compute Engine operations) and others applying globally (like project). The command validates property names but may not immediately validate values, which could lead to errors in future commands if invalid. Command-line flags always take precedence over configured properties, allowing temporary overrides without changing stored configuration. Properties are saved to the active configuration, so switching configurations changes the effective property values. This property-based system is central to efficient gcloud usage, particularly for users managing resources across multiple zones or projects.
How do I run a basic gcloud-config-set example?
Run `gcloud config set project [project-id]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does project do in gcloud-config-set?
Default project ID.