How to ssh into GCP using Windows Terminal

Google Cloud Platform (GCP)

As we live in a world of automation, it does not seem right to do work specially in a tech space manually. We need automation to effectively work and progress. You can read the entire tutorial on my GitHub.

You can also view the tutorial on my YouTube channel. Video link is provided below:

There are three methods to access Google Cloud Platform project:

  • Access via Chrome
  • Access via Command Prompt
  • Access via a custom Windows Terminal tab (best!!)

Process for Chrome:

  1. Open Google Chrome
  2. Type “https://console.cloud.google.com/"
  3. And you can access it!!

Process for Installing Google Cloud SDK:

  1. Install Google Cloud SDK (https://cloud.google.com/sdk/docs/downloads-interactive)
  2. Click “Next”
  3. Click “I Agree”
  4. It’s installed!!

Process for Command Prompt (via PuTTy):

  1. Open Windows Terminal
  2. Then, open Command Prompt
  3. Type “gcloud cloud-shell ssh”
  4. And you can access it!!

Process for a custom Windows Terminal tab:

  1. Open Windows Terminal
  2. Go to Settings and click “Open JSON file”
  3. Then add the following:
{ 
"backgroundImage": "C:/Users/user/Downloads/Pictures/gcp.png",
"backgroundImageOpacity": 0.2,
"commandline": "wsl ~/ssh-gcloud-env.sh [email] [project_id]",
"hidden": false,
"icon": "C:/Users/user/Downloads/Pictures/gcp.png",
"name": "SSH into GCP"
},

4. Then, open your wsl2 Ubuntu VM, and in your /home/user/ directory make a file named “ssh-gcloud-env.sh”. And type in the following commands:

gcloud auth login $1
gcloud config set project $2
gcloud cloud-shell ssh

Link for the file:

5. Save the file and type the following:

chmod +x ssh-gcloud-env.sh

6. Finally, go to your Windows Terminal and open the custom tab.

Yay! We did it!!! 🎉🎉🎉

--

--

--

I am a DevOps Engineer working on cloud technologies (AWS, GCP, Azure) at Xgrid.co

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

DIY — Resumap! 🗺

Day 77/100 Happy Coding!

Flutter Studio, Version 2

ZFS: Best Practices and Caveats

Deal with Memory Gently using “Yield” in PHP

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

Reduce Cost and Increase Productivity with Value Added IT Services from buzinessware — {link} -

Run Flask app on node.js server

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Muhammad Saad

Muhammad Saad

I am a DevOps Engineer working on cloud technologies (AWS, GCP, Azure) at Xgrid.co

More from Medium

Installing NGINX Web Server on Ubuntu 18.04 LTS

Docker Network Drivers Overview | Networking in Docker #3

How to Install the Apache Web Server on CentOS8