In Cloud Raya, we have several ways to access our VM. If we want to securely access the VM, we can use the SSH key feature.
It is really simple to generate the SSH key because Cloud Raya will help us to generate and insert it into the VM. Below are the steps that we can follow:
After login into the Cloud Raya dashboard, we can click Networking then Choose SSH.
Change the Location to “Surabaya“.
In the right pane, we can click the “Create SSH” key button to generate the SSH key.
Then, it will display a new screen and fill it as follow :
After we click Create New SSH key button, our SSH key will be listed on the SSH list.
Click the “Download” button and save the private key to your computer or server that we will use to connect to the VM in Cloud Raya.
After we download the SSH, the Cloud Raya dashboard will display the SSH key name.
Next step, we can continue to create the VM using the SSH key.
Click Add VM and in the right pane choose the SSH Key with ssh-key-cr.
Choose the OS image, in this tutorial we will use Ubuntu 20.04.
Click next until the VM is created.
After the VM has been created, we can see SSH key Name on the right bottom specification of the VM.
It means we are ready to access the VM using the SSH key.
Access the server using the SSH key
Now, we will verify the Private key that we have downloaded previously.
Login to your PC or server then copies the downloaded private key. Change the permission of the private key as follow
# chmod 400 ssh-key-cr
Connect your VM in Cloud Raya using a command.
ssh -i ssh-key-cr 199.180.xx.xx
ssh -i ssh-key-cr IP_Address_Cloudraya
SSH key feature will be working on the new VM when this article is coming out (April 2022). For the previous VM that has been deployed, we are still able to use the SSH key feature. We can follow the steps below:
Login to the VM that we will enable the SSH key, then edit /etc/cloud/cloud.cfg as follow:
Save the file then stop or shut down the VM. In Detail Information of the VM, click Reset SSH Key.
Choose the SSH key that we want to use “ssh-key-cr” and tick “It will perform reset VM root password too”. After that, click “Reset SSH”
After all the setting has been configured, start the VM again to use the new configuration.
We can make sure the VM using a new configuration by file /root/.ssh/authorized_keys has the public key.
Now your VM in Cloudraya is using the SSH key. Please don’t hesitate to contact our support if you have difficulties using the SSH key.