LinuxCommandLibrary

gcloud-init

Initialize Google Cloud environment on instances

TLDR

Launch a "Getting Started" workflow

$ gcloud init
copy

Launch a workflow without diagnostics
$ gcloud init --skip-diagnostics
copy

Use the console for authentication
$ gcloud init --console-only
copy

SYNOPSIS

gcloud init [--bypass-activation] [--bypass-browser] [--console-only] [--no-launch-browser] [GLOBAL-FLAGS]

PARAMETERS

--bypass-activation
    Skip the Cloud SDK activation page and print only the welcome message.

--bypass-browser
    Do not automatically open the browser for authentication; instruct user to manually open the URL.

--console-only
    Use only the console flow for authentication, never browser.

--no-launch-browser
    Do not launch the browser locally even if possible (deprecated; use --bypass-browser).

--help
    Show help for the command and exit.

--verbosity
    Override default verbosity for the command (debug/info/default/warning/error/critical/none).

--log-http
    Log all HTTP server interactions to file.

DESCRIPTION

The gcloud init command initializes the Google Cloud CLI (gcloud) by guiding users through an interactive setup process.

It performs several key tasks: authenticates the user with their Google account via browser-based OAuth flow (or console-only mode), lists and selects a default Google Cloud project, configures default compute region and zone, enables required API components, and sets up the configuration properties file (usually ~/.config/gcloud/configurations/config_default).

This is the recommended starting point for new users or fresh installations of the Google Cloud SDK. It ensures the environment is properly configured for subsequent gcloud commands. The process is user-friendly, with prompts at each step, and supports skipping browser launch for headless environments.

After completion, users can verify setup with gcloud config list or begin using services like Compute Engine, Kubernetes Engine, or Cloud Storage.

CAVEATS

Requires internet access for authentication; interactive by default (use flags for automation); overwrites existing default configuration without warning if run multiple times.

USAGE EXAMPLE

gcloud init --console-only
Initializes in console-only mode for servers without GUI.

POST-INIT VERIFICATION

Run gcloud config list to confirm project, account, and compute defaults.

HISTORY

Introduced with the initial release of Google Cloud SDK in 2013 as part of efforts to simplify CLI setup for Google App Engine and Compute Engine. Evolved with SDK updates to support multi-configuration, Workload Identity Federation, and improved auth flows; current version aligns with Cloud SDK 400+ series.

SEE ALSO

gcloud config list(1), gcloud auth login(1), gcloud projects list(1), gcloud config configurations(1)

Copied to clipboard