Google Associate Cloud EngineerSetting up a cloud solution environmentHard
A solutions architect is designing a multi-region disaster recovery strategy. They need to ensure that the `gcloud` CLI can consistently identify the correct project and region for commands, even when working with multiple distinct configurations for different environments (e.g., production, staging, development) and regions. Which `gcloud` feature should they leverage to manage these distinct settings efficiently?
- AModifying the `~/.config/gcloud/properties` file directly.
- BCreating and activating named `gcloud` configurations.
- CStoring environment variables for `CLOUDSDK_CORE_PROJECT` and `CLOUDSDK_COMPUTE_REGION`.
- DUsing the `--project` and `--region` flags for every command.
Show answer & explanationAnswer & explanation
Correct answer: B. Creating and activating named `gcloud` configurations.
Named `gcloud` configurations allow users to define and store distinct sets of properties (like active project, region, account) under unique names. This enables quick switching between complex environments without needing to specify flags for every command or manually manage environment variables, which is ideal for a multi-region disaster recovery setup with different environments.
Why the other options are wrong
- A. Directly editing configuration files is generally discouraged and less user-friendly than using `gcloud` commands for managing configurations.
- C. Environment variables can work, but `gcloud` configurations offer a more integrated and manageable solution within the `gcloud` ecosystem, especially for multiple complex sets of settings.
- D. While functional, this is inefficient and prone to errors for frequent switching across many commands.
gcloud Named Configurations
Google Cloud CLI named configurations allow users to define and switch between multiple distinct sets of `gcloud` properties (e.g., project, account, region) to manage different environments or workflows.
- Store multiple sets of `gcloud` settings.
- Activated using `gcloud config configurations activate [NAME]`.
- Streamlines switching between development, staging, production, or multi-region setups.
Memory trick: For distinct 'config's, 'activate' the 'named' ones.