Manage Google Cloud Platform (GCP) with Cloud SDK

In this blog post, I will show you how to manage Google Cloud Platform (GCP) with Cloud SDK, a command-line tool.

Cloud SDK

Google Cloud SDK, is GCP’s command-line management tool which allows us to run gcloud commands.

Gcloud commands are commands that we use to deploy, manage and delete resource and objects from GCP.

Installation

Cloud SDK is available for all operating systems platforms, and in this post, I will install it on a Windows 10 machine.

The Cloud SDK installer is available from the following URL.

https://dl.google.com/dl/cloudsdk/channels/rapid/GoogleCloudSDKInstaller.exe

After you download the installer, start the installation process and make sure you install the Beta commands by ticking the checkbox in the select components section.

When the installation is over, you can configure the following settings (shown in the screenshot below)

Authenticate

When you first start Cloud SDK, it will ask you would like to log in and authenticate with GCP.

You can either select yes or use the following command to authenticate.

gcloud auth login

If you click yes, you will be redirected to the GCP login page using your browser.

In case, you need to use a different account to authenticate, copy the login URL and paste it into a browser that is using in private mode.

Click Allow to give Cloud SDK permissions manage GCP.

Note: If you missed the initial login wizard you can always start it again by running the followng command.

gcloud init

After you have authenticated, you will need to select which project you would like to work on using the picker option, as shown below.

Unset Project

To unset the configuration and exit the project

gcloud config unset project

View All projects

To view, all projects run the following command

gcloud projects list

Set project

In case you need to change the project, you can use the following command with the project details.

gcloud config set project ntweekly

Processing…
Success! You're on the list.

Posted

in

by