Connect GCP Compute Engine Via SSH Termius
Rusydy
Posted on January 1, 2023
To connect to a Google Cloud Platform (GCP) Compute Engine instance using SSH and Termius, you will need to follow these steps:
Steps to Generate and Register SSH Key
Generate an SSH key pair on your local machine.
ssh-keygen -t rsa -f ~/.ssh/KEY_FILENAME -C USERNAME -b 2048
KEY_FILENAME: This is the name of the SSH key pair. You can use any name you want, but it is recommended that you use a name that is unique to the Compute Engine instance you are connecting to.
USERNAME: This is the username you want to use to log in to the Compute Engine instance.
The default location for the SSH key pair is ~/.ssh. If you would like to change the location, you can use the -d option.
The default size for the SSH key pair is 2048 bits. If you would like to change the size, you can use the -b option.
Register your Public Key to Compute Engine Instance
- Copy the public key to the clipboard by running the following command:
cat ~/.ssh/id_rsa.pub
- Navigate to the "Metadata" section of the Compute Engine instance in the GCP Console.
- Click the "Edit" button.
- Click the "SSH Keys" tab.
- Click the "Add Item" button.
- Paste the public key into the "Key" field.
- Click the "Save" button.
Steps to Connect to Compute Engine Instance
- Open Termius on your local machine.
- In the Termius dashboard, click the "Add Host" button.
-
In the "Add Host" window, enter the following information:
- Address: This should be the external IP address of your Compute Engine instance. You can find the external IP address in the GCP Console by navigating to the "Networking" section and clicking on the "External IP addresses" tab.
- Port: The default SSH port is 22, so you can leave this field set to 22 unless you have changed the default port for your instance.
- Username: This should be the username you want to use to log in to the Compute Engine instance.
- Set a Key: Use the private key from ssh key we generated previously.
Click the "Save" button in the "Add Host" window.
Click the "Connect" button next to the host you just created.
You should now be connected to the Compute Engine instance.
Note: If you are having trouble connecting to your Compute Engine instance, make sure that the firewall rules for the instance allow incoming connections on port 22 (the default SSH port) and that the instance has a public IP address. You can also check the logs for the instance in the GCP Console to see if there are any error messages that can help troubleshoot the issue.
Posted on January 1, 2023
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.