Adding Public Key to GCP

By | 05/12/2019

The following is OSX related, sorry windows users… you’re on your own!

I’m assuming you already have your Public & Private keys set up, if not head to the terminal and type

$ ssh-keygen -t rsa

You’ll then need to copy the public key to your clipboard, so again in the terminal type

$ pbcopy < ~/.ssh/

Now head to compute > compute engine > metadata and in the sub menu at the top select SSH Keys. Hit Add SSH Key and paste your copied key into the text area.

Find your instance IP address from your VM instance list, head to the terminal and ssh into your instance, using 123.456.7.8 in example below

$ ssh 123.456.7.8

You’ll see a warning ending with ‘Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law.’ which means you’re in!

Test all’s good by running

$ sudo apt-get update