Getting Started with gcloud Commands on GCP.
gcloud
is the command-line interface (CLI) for the Google Cloud Platform (GCP). Gcloud commands allows users to interact with GCP resources and services, including managing virtual machines, deploying applications, configuring networking, and more.
With gcloud
, users can manage their GCP resources from their local machine without using the web console. The gcloud
CLI can be installed on Windows, Linux, and macOS machines.
gcloud
provides a set of commands that can be used to perform various operations on GCP resources, such as creating and managing virtual machines, creating and managing storage buckets, and managing network configurations.
Users can also use gcloud
to interact with services like Google Kubernetes Engine (GKE), Google Cloud Storage, and Google Cloud SQL. gcloud
commands can be run in a terminal window or incorporated into scripts for automated workflows.
How to manage oauth2 credentials in GCP
The gcloud auth commands are used to add and remove access to the Google Cloud CLI. If you come from an AWS background, Google Auth works exactly the same as AWS SSO.
To manage OAuth2 credentials in Google Cloud Platform (GCP), you can use the Cloud Console or the gcloud command-line tool. Here are the general steps:
- Create a project in the GCP Console if you haven’t already done so.
- Go to the APIs & Services Dashboard and click on the “+CREATE CREDENTIALS” button.
- Select “OAuth client ID” from the dropdown menu.
- Choose your application type (Web application, Android, iOS, or Desktop app) and provide the required information.
- Once the OAuth2 client ID is created, you can view, edit, or delete it from the Credentials page in the Console.
- To use the client ID in your application, you’ll need to configure your application to use the OAuth2 flow appropriate for your application type. This will typically involve redirecting users to a Google sign-in page and obtaining an authorization code or token that can be used to make API requests on behalf of the user.
To manage OAuth2 credentials using the gcloud command-line tool, you can use the gcloud auth application-default
command. This command sets up application default credentials for your local development environment.
Here are the general steps:
Step 1 – Install the GCLOUD Command Line Tool
- Install the gcloud command-line tool if you haven’t already done so.
If you are using Debian / Ubuntu – use these commands as a short cut
curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-cli-462.0.1-linux-x86_64.tar.gz
tar -xf google-cloud-cli-462.0.1-linux-x86_64.tar.gz
./google-cloud-sdk/install.sh
You will get output similar to this:
Welcome to the Google Cloud CLI!
To help improve the quality of this product, we collect anonymized usage data
and anonymized stacktraces when crashes are encountered; additional information
is available at <https://cloud.google.com/sdk/usage-statistics>. This data is
handled in accordance with our privacy policy
<https://cloud.google.com/terms/cloud-privacy-notice>. You may choose to opt in this
collection now (by choosing 'Y' at the below prompt), or at any time in the
future by running the following command:
gcloud config set disable_usage_reporting false
Do you want to help improve the Google Cloud CLI (y/N)? n
Your current Google Cloud CLI version is: 462.0.1
The latest available version is: 462.0.1
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ Components โ
โโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโค
โ Status โ Name โ ID โ Size โ
โโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโค
โ Not Installed โ App Engine Go Extensions โ app-engine-go โ 4.7 MiB โ
โ Not Installed โ Appctl โ appctl โ 21.0 MiB โ
โ Not Installed โ Artifact Registry Go Module Package Helper โ package-go-module โ < 1 MiB โ
โ Not Installed โ Cloud Bigtable Command Line Tool โ cbt โ 16.5 MiB โ
โ Not Installed โ Cloud Bigtable Emulator โ bigtable โ 7.1 MiB โ
โ Not Installed โ Cloud Datastore Emulator โ cloud-datastore-emulator โ 36.2 MiB โ
โ Not Installed โ Cloud Firestore Emulator โ cloud-firestore-emulator โ 42.8 MiB โ
โ Not Installed โ Cloud Pub/Sub Emulator โ pubsub-emulator โ 62.1 MiB โ
โ Not Installed โ Cloud Run Proxy โ cloud-run-proxy โ 13.3 MiB โ
โ Not Installed โ Cloud SQL Proxy โ cloud_sql_proxy โ 7.8 MiB โ
โ Not Installed โ Cloud Spanner Emulator โ cloud-spanner-emulator โ 36.0 MiB โ
โ Not Installed โ Cloud Spanner Migration Tool โ harbourbridge โ 20.9 MiB โ
โ Not Installed โ Google Container Registry's Docker credential helper โ docker-credential-gcr โ 1.8 MiB โ
โ Not Installed โ Kustomize โ kustomize โ 4.3 MiB โ
โ Not Installed โ Log Streaming โ log-streaming โ 13.9 MiB โ
โ Not Installed โ Minikube โ minikube โ 35.4 MiB โ
โ Not Installed โ Nomos CLI โ nomos โ 28.7 MiB โ
โ Not Installed โ On-Demand Scanning API extraction helper โ local-extract โ 14.4 MiB โ
โ Not Installed โ Skaffold โ skaffold โ 23.4 MiB โ
โ Not Installed โ Spanner migration tool โ spanner-migration-tool โ 23.5 MiB โ
โ Not Installed โ Terraform Tools โ terraform-tools โ 66.1 MiB โ
โ Not Installed โ anthos-auth โ anthos-auth โ 21.8 MiB โ
โ Not Installed โ config-connector โ config-connector โ 56.7 MiB โ
โ Not Installed โ enterprise-certificate-proxy โ enterprise-certificate-proxy โ 8.6 MiB โ
โ Not Installed โ gcloud Alpha Commands โ alpha โ < 1 MiB โ
โ Not Installed โ gcloud Beta Commands โ beta โ < 1 MiB โ
โ Not Installed โ gcloud app Java Extensions โ app-engine-java โ 125.9 MiB โ
โ Not Installed โ gcloud app Python Extensions โ app-engine-python โ 8.4 MiB โ
โ Not Installed โ gcloud app Python Extensions (Extra Libraries) โ app-engine-python-extras โ 31.5 MiB โ
โ Not Installed โ gke-gcloud-auth-plugin โ gke-gcloud-auth-plugin โ 7.9 MiB โ
โ Not Installed โ kpt โ kpt โ 14.4 MiB โ
โ Not Installed โ kubectl โ kubectl โ < 1 MiB โ
โ Not Installed โ kubectl-oidc โ kubectl-oidc โ 21.8 MiB โ
โ Not Installed โ pkg โ pkg โ โ
โ Installed โ BigQuery Command Line Tool โ bq โ 1.6 MiB โ
โ Installed โ Bundled Python 3.11 โ bundled-python3-unix โ 73.8 MiB โ
โ Installed โ Cloud Storage Command Line Tool โ gsutil โ 11.3 MiB โ
โ Installed โ Google Cloud CLI Core Libraries โ core โ 22.4 MiB โ
โ Installed โ Google Cloud CRC32C Hash Tool โ gcloud-crc32c โ 1.2 MiB โ
โโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
To install or remove components at your current SDK version [462.0.1], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [462.0.1], run:
$ gcloud components update
Modify profile to update your $PATH and enable shell command completion?
Do you want to continue (Y/n)? y
The Google Cloud SDK installer will now prompt you to update an rc file to bring the Google Cloud
CLIs into your environment.
Enter a path to an rc file to update, or leave blank to use [/home/rbailey/.bashrc]:
Backing up [/home/rbailey/.bashrc] to [/home/rbailey/.bashrc.backup].
[/home/rbailey/.bashrc] has been updated.
==> Start a new shell for the changes to take effect.
For more information on how to get started, please visit:
https://cloud.google.com/sdk/docs/quickstarts
You need to close your terminal and reopen to pick up GCLOUD.
Step 2 – Update Gcloud Components (Optional)
If you want to install all of the gcloud components issue this command
First update gcloud
gcloud components update
You should see this update:
Beginning update. This process may take several minutes.
Your current Google Cloud CLI version is: 462.0.1
You will be upgraded to version: 485.0.0
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ These components will be updated. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโฌโโโโโโโโโโโค
โ Name โ Version โ Size โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโผโโโโโโโโโโโค
โ BigQuery Command Line Tool โ 2.1.7 โ 1.7 MiB โ
โ Bundled Python 3.11 (Platform Specific) โ 3.11.8 โ 74.0 MiB โ
โ Cloud Storage Command Line Tool โ 5.30 โ 11.3 MiB โ
โ Google Cloud CLI Core Libraries โ 2024.07.19 โ 19.2 MiB โ
โ Google Cloud CRC32C Hash Tool (Platform Specific) โ 1.0.0 โ 1.3 MiB โ
โ anthoscli (Platform Specific) โ 0.2.52 โ 69.2 MiB โ
โ gcloud cli dependencies โ 2024.07.12 โ 16.6 MiB โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโดโโโโโโโโโโโ
A lot has changed since your last upgrade. For the latest full release notes,
please visit:
https://cloud.google.com/sdk/release_notes
Do you want to continue (Y/n)? y
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Creating update staging area โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: BigQuery Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: Bundled Python 3.11 โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: Cloud Storage Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: Google Cloud CLI Core Libraries โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: Google Cloud CRC32C Hash Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: anthoscli โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Uninstalling: gcloud cli dependencies โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: BigQuery Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Bundled Python 3.11 (Platform Specific) โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Storage Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Google Cloud CLI Core Libraries โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Google Cloud CRC32C Hash Tool (Platform S... โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: anthoscli (Platform Specific) โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud cli dependencies โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Creating backup and activating new installation โโฃ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Performing post processing steps...done.
Update done!
To revert your CLI to the previously installed version, you may run:
$ gcloud components update --version 462.0.1
You can now update everything else related to gcloud
gcloud components install `gcloud components list | grep "Not Installed" | awk -F 'โ' '{print $4}' | xargs`
You will see the following output. Note: Installation can take several minutes.
gcloud components install `gcloud components list | grep "Not Installed" | awk -F 'โ' '{print $4}' | xargs`
Your current Google Cloud CLI version is: 462.0.1
The latest available version is: 462.0.1
To install or remove components at your current SDK version [462.0.1], run:
$ gcloud components install COMPONENT_ID
$ gcloud components remove COMPONENT_ID
To update your SDK installation to the latest version [462.0.1], run:
$ gcloud components update
Your current Google Cloud CLI version is: 462.0.1
Installing components from version: 462.0.1
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ These components will be installed. โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโโโโโฌโโโโโโโโโโโโค
โ Name โ Version โ Size โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโผโโโโโโโโโโโโโโโโผโโโโโโโโโโโโค
โ App Engine Go Extensions โ 1.9.76 โ 4.7 MiB โ
โ Appctl โ 0.1.12 โ 21.0 MiB โ
โ Artifact Registry Go Module Package Helper โ 0.4.0 โ < 1 MiB โ
โ Cloud Bigtable Command Line Tool โ 1.17.2 โ 16.5 MiB โ
โ Cloud Bigtable Emulator โ โ 7.1 MiB โ
โ Cloud Datastore Emulator โ 2.3.1 โ 36.2 MiB โ
โ Cloud Firestore Emulator โ 1.18.2 โ 42.8 MiB โ
โ Cloud Pub/Sub Emulator โ 0.8.10 โ 62.1 MiB โ
โ Cloud Run Proxy โ 0.5.0 โ 13.3 MiB โ
โ Cloud SQL Proxy โ 1.27.0 โ 7.8 MiB โ
โ Cloud Spanner Emulator โ 1.5.13 โ 36.0 MiB โ
โ Cloud Spanner Migration Tool โ 3.0.0 โ 20.9 MiB โ
โ Google Container Registry's Docker credential helper โ 1.5.0 โ 1.8 MiB โ
โ Kustomize โ 4.4.0 โ 4.3 MiB โ
โ Log Streaming โ 0.3.0 โ 13.9 MiB โ
โ Minikube โ 1.32.0 โ 35.4 MiB โ
โ Nomos CLI โ 1.17.0-rc.4 โ 28.7 MiB โ
โ On-Demand Scanning API extraction helper โ 1.5.9 โ 14.4 MiB โ
โ Skaffold โ 2.9.0 โ 23.4 MiB โ
โ Spanner migration tool โ 3.2.2 โ 23.5 MiB โ
โ Terraform Tools โ 0.11.1 โ 66.1 MiB โ
โ anthos-auth โ 1.5.0 โ 21.8 MiB โ
โ config-connector โ 1.93.0 โ 56.7 MiB โ
โ enterprise-certificate-proxy โ 0.3.2 โ 8.6 MiB โ
โ gRPC Python library โ 1.20.0 โ 2.1 MiB โ
โ gcloud Alpha Commands โ 2024.01.31 โ < 1 MiB โ
โ gcloud Beta Commands โ 2024.01.31 โ < 1 MiB โ
โ gcloud app Java Extensions โ 2.0.24 โ 125.9 MiB โ
โ gcloud app Python Extensions โ 1.9.108 โ 8.4 MiB โ
โ gcloud app Python Extensions (Extra Libraries) โ 1.9.102 โ 31.5 MiB โ
โ gke-gcloud-auth-plugin โ 0.5.8 โ 7.9 MiB โ
โ kpt โ 1.0.0-beta.49 โ 14.4 MiB โ
โ kubectl โ 1.27.9 โ 99.9 MiB โ
โ kubectl โ 1.27.9 โ < 1 MiB โ
โ kubectl-oidc โ 1.5.0 โ 21.8 MiB โ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโดโโโโโโโโโโโโโโโโดโโโโโโโโโโโโ
For the latest full release notes, please visit:
https://cloud.google.com/sdk/release_notes
Do you want to continue (Y/n)? y
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
โ โ Creating update staging area โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: App Engine Go Extensions โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: App Engine Go Extensions โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Appctl โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Appctl โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Artifact Registry Go Module Package Helper โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Artifact Registry Go Module Package Helper โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Bigtable Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Bigtable Command Line Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Bigtable Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Bigtable Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Datastore Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Firestore Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Pub/Sub Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Run Proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Run Proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud SQL Proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud SQL Proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Spanner Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Spanner Emulator โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Spanner Migration Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Cloud Spanner Migration Tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Google Container Registry's Docker creden... โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Google Container Registry's Docker creden... โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Kustomize โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Kustomize โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Log Streaming โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Log Streaming โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Minikube โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Minikube โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Nomos CLI โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Nomos CLI โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: On-Demand Scanning API extraction helper โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: On-Demand Scanning API extraction helper โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Skaffold โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Skaffold โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Spanner migration tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Spanner migration tool โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Terraform Tools โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: Terraform Tools โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: anthos-auth โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: anthos-auth โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: config-connector โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: config-connector โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: enterprise-certificate-proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: enterprise-certificate-proxy โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gRPC Python library โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gRPC Python library โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud Alpha Commands โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud Beta Commands โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud app Java Extensions โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud app Python Extensions โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gcloud app Python Extensions (Extra Libra... โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gke-gcloud-auth-plugin โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: gke-gcloud-auth-plugin โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kpt โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kpt โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kubectl โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kubectl โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kubectl-oidc โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: kubectl-oidc โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Installing: pkg โโฃ
โ โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโฃ
โ โ Creating backup and activating new installation โโฃ
โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
Performing post processing steps...done.
Update done!
Step 3 – Authenticate Gcloud with your Gcloud Account
Open a terminal window and run the following command to authenticate with your GCP account:
gcloud auth login
This will open a Web Browser for you to log into your Google Account.
Once you’ve authenticated, run the following command to set up application default credentials:
gcloud auth application-default login
This will generate a new OAuth2 client ID and store it locally.
To view or manage your application default credentials, run the following command:
gcloud auth application-default --help
This will show you the available options for managing your credentials.
Note that application default credentials are typically used for local development and testing. In production, you should use a more secure authentication method, such as service accounts.
Step 4 – How to Create and Manipulate Compute Engine Resources.
The bulk of the gcloud commands are kept under gcloud compute group. This selection manages all GCP resources.
All commands start gcloud compute
Compute
firewall-policies
Manage Compute Engine organization firewall policies.
machine-images
Read and manage Compute Engine machine image resources.
network-firewall-policies
Manage Compute Engine network firewall policies.
reservations
Manage Compute Engine reservations.
resource-policies
Manage Compute Engine Resource Policies.
Disks
disk-types
Read Compute Engine virtual disk types.
disks
Read and manipulate Compute Engine disks.
Info
accelerator-types
Read Compute Engine accelerator types.
machine-types
Read Compute Engine virtual machine types.
operations
Read and manipulate Compute Engine operations.
regions
List Compute Engine regions.
zones
List Compute Engine zones.
Instances
commitments
Manage Compute Engine commitments.
diagnose
Debugging tools for Compute Engine virtual machine instances.
images
List, create, and delete Compute Engine images.
instance-groups
Read and manipulate Compute Engine instance groups.
instance-templates
Read and manipulate Compute Engine instances templates.
instances
Read and manipulate Compute Engine virtual machine instances.
snapshots
List, describe, and delete Compute Engine snapshots.
sole-tenancy
Read and manage Compute Engine sole-tenancy resources.
target-instances
Read and manipulate Compute Engine virtual target instances.
tpus
List, create, and delete Cloud TPUs.
Load Balancing
backend-buckets
Read and manipulate backend buckets.
backend-services
List, create, and delete backend services.
forwarding-rules
Read and manipulate traffic forwarding rules to network load balancers.
health-checks
Read and manipulate health checks for load balanced instances.
http-health-checks
Read and manipulate HTTP health checks for load balanced instances.
https-health-checks
Read and manipulate HTTPS health checks for load balanced instances.
security-policies
Read and manipulate Cloud Armor security policies.
ssl-certificates
List, create, and delete Compute Engine SSL certificate resources.
ssl-policies
List, create, delete and update Compute Engine SSL policies.
target-pools
Control Compute Engine target pools for network load balancing.
Networking
addresses
Read and manipulate Compute Engine addresses.
external-vpn-gateways
List, create, delete and update External VPN Gateways.
firewall-rules
List, create, update, and delete Compute Engine firewall rules.
interconnects
Read and manipulate Compute Engine interconnects.
network-endpoint-groups
Read and manipulate Compute Engine network endpoint groups.
networks
List, create, and delete Compute Engine networks.
packet-mirrorings
Manage Compute Engine packet mirroring resources.
public-advertised-prefixes
Manage public advertised prefix resources.
public-delegated-prefixes
Manage public delegated prefix resources.
routers
List, create, and delete Compute Engine routers.
routes
Read and manipulate routes.
service-attachments
Manage Compute Engine service attachment resources.
shared-vpc
Configure shared VPC.
target-grpc-proxies
Manage Compute Engine target gRPC proxy resources.
target-http-proxies
List, create, and delete target HTTP proxies.
target-https-proxies
List, create, and delete target HTTPS proxies.
target-ssl-proxies
List, create, and delete target SSL proxies.
target-tcp-proxies
List, create, and delete target TCP proxies.
target-vpn-gateways
Read and manipulate classic VPN gateways.
url-maps
List, create, and delete URL maps.
vpn-gateways
read and manipulate Highly Available VPN Gateways.
vpn-tunnels
Read and manipulate Compute Engine VPN tunnels.
Tools
os-config
Manage OS Config tasks for Compute Engine VM instances.
os-login
Create and manipulate Compute Engine OS Login resources.
project-info
Read and manipulate project-level data like quotas and metadata.
Available commands for gcloud compute:
Other
copy-files
*(DEPRECATED)* Copy files to and from Google Compute Engine virtual machines via scp.
start-iap-tunnel
Starts an IAP TCP forwarding tunnel.
Tools
config-ssh
Populate SSH config files with Host entries from each instance.
connect-to-serial-port
Connect to the serial port of an instance.
reset-windows-password
Reset and return a password for a Windows machine instance.
scp
Copy files to and from Google Compute Engine virtual machines via scp.
sign-url
Sign specified URL for use with Cloud CDN Signed URLs.
ssh
SSH into a virtual machine instance.
Here are the general steps to create and manipulate Compute Engine resources using the gcloud
command-line tool:
- Install the gcloud command-line tool if you haven’t already done so.
- Authenticate with your GCP account by running the following command and following the on-screen prompts:
gcloud auth login
Create a new Compute Engine instance by running the following command:
gcloud compute instances create INSTANCE-NAME --machine-type MACHINE-TYPE --image IMAGE-NAME --zone ZONE
Replace INSTANCE-NAME
with a name for your instance, MACHINE-TYPE
with the machine type you want to use (e.g., n1-standard-1
), IMAGE-NAME
with the name of the image you want to use (e.g., ubuntu-2004-lts
), and ZONE
with the zone you want to create the instance in (e.g., us-central1-a
).
List your Compute Engine instances by running the following command:
gcloud compute instances list
This will show you a list of all your instances and their current status.
Connect to your instance by running the following command:
gcloud compute ssh INSTANCE-NAME --zone ZONE
Replace INSTANCE-NAME
with the name of the instance you want to connect to and ZONE
with the zone it’s in.
Stop or start an instance by running the following command:
gcloud compute instances stop INSTANCE-NAME --zone ZONE
or
gcloud compute instances start INSTANCE-NAME --zone ZONE
Replace INSTANCE-NAME
with the name of the instance you want to stop or start, and ZONE
with the zone it’s in.
Delete an instance by running the following command:
gcloud compute instances delete INSTANCE-NAME --zone ZONE Replace INSTANCE-NAME with the name of the instance you want to delete, and ZONE with the zone it's in.
These are just a few examples of the many things you can do with the gcloud
command-line tool and Compute Engine. You can find more information and examples in the gcloud
documentation.
How to edit Google Cloud CLI properties?
The gcloud config command group lets you set, view and unset properties Google Cloud CLI uses.
Remember you can use gcloud info to learn about your current properties and environmental variables
gcloud config
gcloud config list
gcloud config set
gcloud config unset
how to list the services used by the project
try something like this from gcloud:
gcloud services list –enabled