gcloud init¶
gcloud init is the primary command used to configure the Google Cloud SDK. It guides users through the initial setup process, including authentication, project selection, and the configuration of default compute regions and zones.^[400-devops__05-Cloud-Provider__GCP.md]
Configuration Workflow¶
When executed, the command initiates a step-by-step wizard to set up a gcloud configuration.
Authentication¶
The process begins by requiring the user to log in to a Google account. This typically opens a browser window to perform an OAuth 2.0 authentication flow.^[400-devops__05-Cloud-Provider__GCP.md]
Project Selection¶
Once authenticated, the user must select a specific cloud project to use. The command lists available projects associated with the account, allowing the user to choose by numeric ID or project name. There is also an option to create a new project.^[400-devops__05-Cloud-Provider__GCP.md]
Compute Configuration¶
The user is prompted to configure default settings for Google Compute Engine resources. This involves selecting:
* Compute Zone: A specific zone (e.g., asia-east1-b) to be used as the default for resource creation if no zone is specified via command-line flags.^[400-devops__05-Cloud-Provider__GCP.md]
* Compute Region: This is automatically set based on the selected zone (e.g., selecting asia-east1-b sets the region to asia-east1).^[400-devops__05-Cloud-Provider__GCP.md]
Diagnostics¶
By default, the command runs a network diagnostic to detect and fix local network connection issues before proceeding with configuration.^[400-devops__05-Cloud-Provider__GCP.md] Users can skip this step in future runs by using the --skip-diagnostics flag.^[400-devops__05-Cloud-Provider__GCP.md]
Re-initialization¶
If a configuration already exists, running gcloud init offers options to manage the setup:
* Re-initialize: Update the existing configuration (e.g., [default]) with new settings.^[400-devops__05-Cloud-Provider__GCP.md]
* Create a new configuration: Establish a separate configuration profile, which is useful for managing multiple accounts or projects.^[400-devops__05-Cloud-Provider__GCP.md]
Related Concepts¶
Sources¶
^[400-devops__05-Cloud-Provider__GCP.md]