Note: Most of these blogs are for my personal reference and at a given time, some of those might just be unpolished drafts.

gcloud sdk

Accessing gcp compute instances via gcloud sdk

You have a bunch of options to ‘ssh’ into gcp VM instances:

  • open in browser window
  • open in browser window on custom port
  • open in browser window using provided ssh key
  • another ssh client (putty, termius, etc)

I personally find the ‘gcloud sdk’ way much more convenient to use since I can just launch it from my terminal without having to open the browser, log into cloud console, locate the vm instance and then ssh’ing into it.

In order to be able to use the ‘gcloud’ command this way we have to install gcloud sdk. Installation Guide

You can alias those lengthy commands with VM Instance name (which I find very convenient) and just launch it from the terminal.


sudip which $commandname
bastion: aliased to gcloud beta compute --project $project ssh --zone $zone $vm-instance-name
➜  sudip $commandname
Last login: Tue Feb 25 18:26:53 2020 from
/usr/bin/id: cannot find name for group ID 2060275685
-bash-4.2$ kubectl --kubeconfig=/home/kubeconfig/config -n $project-name get pods
NAME                                                 READY   STATUS             RESTARTS   AGE
application-name-57cfb9657d-4hzhl                   1/1     Running            0          15h
Written on February 22, 2020