Get your SSH keys to HANA Express instance in Google Cloud Platform
You’ve been watching this SAP CodeTalk or following this tutorial on how to setup your SAP HANA, express edition, (or HXE) with the Google Cloud Launcher. Now you would like to connect to the instance from some SSH client, such as PuTTY or the console on your Mac or Linux computer.
You need the SSH keys, but where are they? If this is your first project and you have not generated your keys before, chances are that you won’t find them in your .ssh folder as this tutorial indicates:
No need to panic. There’s just one more additional command before you can download your public and private keys.
Open a new gcloud console that is not logged in to the virtual machine using the “prompt” icon on the top-right corner:
Take note of the name of your VM and use it to replace accordingly in the following command:
gcloud compute ssh <<YOUR VM NAME>>
It will ask for confirmation, issue a couple of warnings about not having any keys, ask for a passphrase (please use something you will remember) and finally confirm that your keys have been generated:
Notice that it has logged you into the VM. In order to retrieve the keys, open a new gcloud console to fetch them from the project home folder:
Go into your /home/<<google_user_id>>/.ssh and use the download icon to fetch your private and public SSH keys:
Now you can connect from another console in your Mac or Linux computer using your key with:
ssh -i ~/.ssh/my-ssh-key your_gmail_user_name@external_vm_IP_address
or using PuTTY or WinSCP to transfer files from your Windows computer. More information on the latter or If you are getting an error like Unable to use key file “some path and private key” (OpenSSH SSH-2 private key) in this tutorial.