webstermath
webstermath

Reputation: 599

How to Connect Secure Shell App to a Google Cloud VM Instance

I would like to connect to a Google Cloud VM instance using Secure Shell App (SSA). I assumed this would be easy as these are both Google products and I had no problem before connection SSA to a Digital Ocean Droplet. I have found Google's own documentation to do so here and it looked easy enough to follow. However, the following link in the instructions: Providing public SSH keys to instances leads down a rabbit hole of confusing and seemingly self-contradicting information. I tried to follow it the best I could but kept running into errors. I have searched in vain for better instructions and am still astounded that Google has made it so hard to connect their own products. Is it really this hard to make this work? Are there any better instructions out there? If not, would someone be willing to write up clear and simple instructions?

Upvotes: 0

Views: 396

Answers (1)

Serhii
Serhii

Reputation: 4471

Please follow this step by step instruction:

  1. create a new VM instance-1
  2. connect to it with gcloud compute ssh instance-1 (as mentioned @John Hanley)
  3. check ~/.ssh folder

    $ ls -l ~/.ssh
    -rw------- 1 user usergroup 1856 Dec  9 17:12 google_compute_engine
    -rw-r--r-- 1 user usergroup  417 Dec  9 17:12 google_compute_engine.pub
    
  4. copy keys

    cp ~/.ssh/google_compute_engine.pub mykey.pub
    cp ~/.ssh/google_compute_engine mykey
    
  5. follow instructions from step 7 - create connection and import identity

  6. (optional) if you don't find your mykey in the Indentity list try to connect anyway (ended with an error as expected), then restart Secure Shell App and check Indentity menu again (they should be there without redoing import again)

After that, I successfully connected to my VM via Secure Shell App.

Upvotes: 1

Related Questions