gcloud Overview

This page contains an overview of the gcloud command-line tool and its common command patterns and quirks.

You can use gcloud to create and manage:\colon

  • Google Compute Engine virtual instances and other resources
  • Google Cloud SQL instances
  • Google Kubernetes Engine clusters
  • Google Cloud Dataproc clusters and jobs
  • Google Cloud DNS managed zones and record sets
  • Google Cloud Deployment manager deployments

gcloud and the SDK

gcloud is a part of Google Cloud SDK. You must download and install the SDK on your system and initialize it before you can use gcloud.

Initialize Cloud SDK

After you install Cloud SDK, the next step is typically run the gcloud init command to perform initial setup tasks. You can also run gcloud init at a later time to change your settings or create a new configuration.

gcloud init performs the following setup steps:\colon

  • Authorize Cloud SDK told to use your user account credentials to access Google Cloud Platform, or lets you select an account if you have perviously authorized access
  • Sets up a Cloud SDK configuration and sets a base of properties, including the active account from the step above, the current project, and if applicable, the default Google Compute Engine region and zone.

You can run the following alternatives to gcloud init:\colon

  • gcloud auth login
  • gcloud auth activate-service-account
  • gcloud config [COMMAND]
  • gcloud config configurations [COMMAND]

Run gcloud init

To initialize Cloud SDK:\colon

  1. Run gcloud init:\colon If your in a remote terminal session, you can use the --console-only flag to prevent the command from launching a browser-based authorization flow, if required:\colon gcloud init --console-only
  2. Create or select configuration if prompted. If you are initialing a new Cloud SDK installation, gcloud init creates a new one named default for you and sets it as the active configuration. If you have existing configurations, gcloud init prompts to choose between three options - re-initialize the active one, switch to another one and re-initialize it, or create a new one.
  3. Complete the authorization step when prompted. Depending on whether you have previously authorized access to the Cloud Platform, you may be prompted to log in and grant access in a web browser, or to select an existing account. If you used the --console-only flag and login is required, you must then cut and paste the provided authorization URL into another browser window and follow the prompts provided. When this step is completed, gcloud init sets the account property in the configuration to the specified account.
  4. Choose a current Cloud Platform project if prompted. If you only have access to one project, including the default project for your user account, gcloud init selects it for you. Otherwise, you can select a project from a list of projects for which you have Owner, Editor, or Viewer permissions. gcloud init sets the project property in the configuration to the property you choose.
  5. Choose a default Google Compute Engine zone if prompted. If you do not have a the Compute Engine API enabled or you already have a default zone in your project-level metadata, you will not see this step. gcloud init sets the region and zone properties in the configuration using the zone you choose.

When gcloud init finishes, it prints the properties in the active configuration to the terminal:\colon

[compute]
region = us-east1
zone = us-east1-b
[core]
account = [email protected]
disable_usage_reporting = False
project = example-project

You can view these properties at any other time using the gcloud config list commando.

gcloud init

Synopsis gcloud init [--console-only][--skip-diagnostics][GCLOUD_WIDE_FLAG ...]

[0] https://cloud.google.com/sdk/gcloud/

[1] https://cloud.google.com/sdk/docs/initializing

results matching ""

    No results matching ""