LinuxCommandLibrary

gcloud

Manage Google Cloud Platform resources

TLDR

List all properties in one's active configuration

$ gcloud config list
copy

Login to a Google account
$ gcloud auth login
copy

Set the active project
$ gcloud config set project [project_name]
copy

SSH into a virtual machine instance
$ gcloud compute ssh [user]@[instance]
copy

Display all Google Compute Engine instances in a project (by default instances from all zones are listed)
$ gcloud compute instances list
copy

Update a kubeconfig file with the appropriate credentials to point kubectl to a specific cluster in Google Kubernetes Engine (GKE)
$ gcloud container clusters get-credentials [cluster_name]
copy

Update all gcloud components
$ gcloud components update
copy

Display help for a given command
$ gcloud help [command]
copy

SYNOPSIS

gcloud [global-flags] command [command-flags] [arguments]

PARAMETERS

--account ACCOUNT
    Google Cloud account to use for authentication.

--project PROJECT_ID
    The Google Cloud project ID to use for this invocation.

--quiet
    Suppress all output except errors.

--verbosity VERBOSITY
    Override the default verbosity for this command.

--zone ZONE
    The Compute Engine zone for the command.

--region REGION
    The Compute Engine region for the command.

--help
    Display help message and exit.

DESCRIPTION

gcloud is the primary command-line interface (CLI) tool for interacting with Google Cloud Platform (GCP). It enables you to manage GCP resources such as virtual machines, storage buckets, databases, and networking configurations directly from your terminal.

gcloud offers a consistent and unified way to automate tasks, deploy applications, and administer your cloud environment. It authenticates with your Google account, allowing you to control access to your projects and resources.

The tool supports a wide range of operations, including creating, updating, deleting, and listing resources. It also provides features for managing configurations, setting project defaults, and enabling services. gcloud utilizes the Google Cloud SDK, which provides a comprehensive suite of tools for building and managing applications on GCP. It's a critical tool for developers and system administrators working with Google Cloud.

CAVEATS

Requires the Google Cloud SDK to be installed and configured properly. Authentication is essential for accessing and managing your Google Cloud resources.

CONFIGURATION

gcloud uses configurations to manage settings such as the default project, account, and region. You can create and switch between configurations to work with different projects and environments efficiently. Use gcloud config to manage your configurations.

AUTHENTICATION

gcloud authenticates your access to Google Cloud resources. You can authenticate using your Google account or service accounts. Use gcloud auth to manage authentication settings. Consider using service accounts for automated processes to grant resources access with more granular rights.

COMPONENTS

gcloud is composed of multiple components. Use gcloud components to manage those components. This allows the user to add or remove gcloud functionality to save space if some functionality will not be needed.

HISTORY

gcloud was developed by Google as the primary CLI tool for Google Cloud Platform. It evolved alongside the growth of GCP services, aiming to provide a unified and consistent interface for managing cloud resources. Initial versions focused on basic resource management, but the tool has expanded significantly to support a wide range of features and integrations. It's a core component of the Google Cloud SDK, reflecting Google's commitment to providing robust command-line tools for cloud development and administration.

SEE ALSO

gsutil(1), bq(1)

Copied to clipboard