Connect to GCE Instance on GCP using a Third Party ssh tool from a Linux System or Mac

  • Basic command of terminal use
  1. Create the GCE Instance,
  2. Generate both private and public keys on my local machine using the ssh-keygen command from an ssh terminal ,
  3. Create a copy of the public key, format it and add it to your instance metadata,
  4. Use the command ssh -i PATH_TO_PRIVATE_KEY USERNAME@IP_ADDRESS_OF_INSTANCE to connect
  • make copy: cd ~/.ssh/uduak.pud ~/.ssh/
  • format it:[USERNAME]:ssh-rsa [EXISTING_KEY_VALUE] [USERNAME]
  • Copy it to a text file: cp ~/.ssh/ ~/.ssh/uduak.txt
  • Send the formatted public key to the instance so admin can add it: gcloud compute scp ~/.ssh/udauk.txt <ADMIN_USERNAME>@<IP_ADDRESS_OF_INSTANCE>:~/ or scp ~/.ssh/uduak.txt <ADMIN_USERNAME>@<IP_ADDRESS_OF_INSTANCE>:~/
  • Admin adds the instance metadata (or you do so if your admin) : gcloud compute instances add-metadata <NAME_OF_INSTANCE> --metadata-from-file ssh-keys=~/.ssh/uduak.txt
  • Now connect to the instance from your machine:



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
george udosen

george udosen


DevOps | FullStack developer | Python::Flask | GCP Cloud Certified | AWS & AZURE Cloud Savy | Linux Sysadmin | Google IT Support