Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use Google Cloud Shell with the new Windows Terminal

I just want to SSH into my compute instances using a profile in the new Windows Terminal app.

like image 293
Shivang P Swain Avatar asked Jul 17 '20 07:07

Shivang P Swain


2 Answers

This worked for me: "commandline": "cmd.exe /k \"C:/Users/**YOUR_USER**/AppData/Local/Google/Cloud SDK/cloud_env.bat\"".

Remember about escaping backslash.

like image 157
Lukasz Pojezierski Avatar answered Oct 28 '22 12:10

Lukasz Pojezierski


Easiest and neat way to do this by running Linux WSL 2 like Ubuntu, install gcloud sdk, then setup gcloud by running gcloud init and use below config in Windows Terminal:

{
  "guid": "{d8567bf5-f802-498a-899a-efedc99a2aa8}",
  "hidden": false,
  "name": "Google Cloud Shell",
  "commandline": "wsl -d Ubuntu-20.04 gcloud beta cloud-shell ssh",
  "fontFace": "Cascadia Code PL",
  "useAcrylic": true,
  "acrylicOpacity": 0.6,
  "backgroundImage": "C:\\Users\\USERNAME\\.terminal\\.gshell-icon.png",
  "icon": "C:\\Users\\USERNAME\\.terminal\\.gcloud-icon.png",
  "backgroundImageStretchMode": "none",
  "backgroundImageAlignment": "center",
  "backgroundImageOpacity": 0.5,
  "tabColor": "#1a73e8",
}    

Note: In the command:

wsl -d WSL-NAME gcloud beta cloud-shell ssh, you can use any wsl like (kali-linux, alpine, openSUSE-Leap-15.2, etc. just make sure you install and setup gcloud sdk)

like image 25
Sanjay Rawat Avatar answered Oct 28 '22 11:10

Sanjay Rawat