How To Setup Google Cloud CLI/SDK

1
673

This tutorial will guide you through steps for setting up google cloud SDK on your workstation.

Note: This tutorial will work only on MAC and Linux systems

Step 1: Select the download appropriate sdk package from https://cloud.google.com/sdk/

Step 2: Untar the sdk package.

Step 3: Install the sdk using the following command.

Step 3: Follow through the installation instruction and select the required options.

Configuring Google Cloud SDK

Follow the steps given below for configuring the google cloud sdk.

1. Initialize the sdk using the following commands. Y

2. Accept the google login option for logging in to your google cloud account.

3. From the browser login to your google cloud account and grant permissions to access google cloud resources.

4. At the command prompt, you will be prompted with options for initial configurations which are self explanatory.

Testing The CLI Setup

Now lets run some basic gcloud cli commands to verify the installation.

1. List the credential account.

2. List the sdk configuration.

3. List all the local gcloud configurations and files

4. To list all the gcloud commands, use the following command.

Create An Instance Using CLI

To start with, we will create a instance using the CLI.

1. Get the list of images using the following command.

2. The following command will create a f1 micro Centos instance. You can refer this official documentation for more information on the flags.

Connecting Instance  Via Ssh

To connect the instance via ssh, just execute the following command. The gcloud command will automatically create the ssh key in your ~/.ssh folder if it doesn’t exist and connects to your instance.

For example,

Deleting The Instance

You can delete the created instance using the following command.

For example,

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.