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

https://cloud.google.com/sdk/gcloud/

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

See your current project

gcloud config list project

Set current project

gcloud config set project PROJECT_ID

Set region/zone

List of regions and zone available at https://cloud.google.com/compute/docs/regions-zones/regions-zones

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 [https://www.googleapis.com/compute/v1/projects/hon-gcp-89355f51d664f6b5/zones/asia-east1-a/instances/hon-web-server].
NAME            ZONE          MACHINE_TYPE   PREEMPTIBLE  INTERNAL_IP  EXTERNAL_IP     STATUS
hon-web-server  asia-east1-a  n1-standard-1               10.140.0.3   104.199.192.91  RUNNING
root@hon-vpn:~# 

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