HostOnNet Blog

Google Cloud

gcloud is command line tool that is used to provision and manage Google Cloud Platform services. You can download and install it from

You can also access it by clicking “Cloud Shell” button on Google Cloud Console top right bar.

See All logged Accounts

gcloud auth list

To Login, run

gcloud auth login


boby@hon-pc-01:~ $ gcloud auth login
WARNING: Failed to start a local webserver listening on any port between 8085 and 8186. Please check your firewall settings or locally running programs that may be blocking or using those ports.
WARNING: Defaulting to URL copy/paste mode.
Go to the following link in your browser:

Enter verification code: 4/EZIloBlkmgb5t0Bp5WbXy9USBWwndgPFrWfvdXepfVs
WARNING: `gcloud auth login` no longer writes application default credentials.
If you need to use ADC, see:
  gcloud auth application-default --help

You are now logged in as [].
Your current project is [None].  You can change this setting by running:
  $ gcloud config set project PROJECT_ID
boby@hon-pc-01:~ $ 

<strong>List all available projects</strong>

boby@hon-pc-01:~ $ gcloud projects list
PROJECT_ID              NAME                    PROJECT_NUMBER
charming-sonar-166306   Not Used                189392009441
cp100-166620            cp100                   768724212491
forum-bestgamenews-com  forum-bestgamenews-com  112973453979
kingashoes-166409       KingaShoesCom           562450418582
lean-166506             Lean                    894293603533
webhostingneeds         WebHostingNeeds         362523391303
boby@hon-pc-01:~ $ 

Set current project

gcloud config set project PROJECT_ID


boby@hon-pc-01:~ $ gcloud config set project cp100-166620
Updated property [core/project].
boby@hon-pc-01:~ $ 

See your current project

gcloud config list project


boby@hon-pc-01:~ $ gcloud config list project
project = cp100-166620

Your active configuration is: [default]
boby@hon-pc-01:~ $ 

Set region/zone

List of regions and zone available at

gcloud config set compute/zone europe-west1-c
gcloud config set compute/region europe-west1

Create VM

Creating a Google Compute instance via gcloud command line.

root@hon-vpn:~# gcloud compute instances create hon-web-server --zone asia-east1-a
Created [].
hon-web-server  asia-east1-a  n1-standard-1       RUNNING

Now lets login to the gcloud instance we created.

gcloud compute ssh SERVER-NAME

List all Running Compute instances

gcloud compute instances list

List all Persistent Disks

gcloud compute disks list

Posted in Cloud