google compute how to use a custom ssh key to connect to your vm

First you must create your ssh key-pair if you haven't go them.  In Google compute, key pair are not automatically generated. 

So create your ssh key pair using the following command

ssh-keygen -t rsa -f ~/.ssh/my-gcp-key -C "jeremy"

When setting up your VM, goto "Security and Access" and look for "SSH key". Your key should be in this format. Please note the format has way too many extra spaces to illustrate the differences.

PROTOCOL                SSH-KEY-PAIR                  USER 

The actual value that gets place int the textbox is this.

ssh-rsa  AAAAB3NzaC1yc2EAAAADAQABAAABgQDVjrBwWKsrGOYluzjMccPgYs5w39GMCY3PtJ/DwW84tudELlUcOWpVLS8Fy+HE= jeremy  

Once your instance has been created, 

To login, fire up your bash shell and then run the following command

ssh -i ~/.ssh/my-gcp-key jeremy@your-public-ip-vm

And you should see something like this:- 






Comments

Popular posts from this blog

gemini cli getting file not defined error

NodeJS: Error: spawn EINVAL in window for node version 20.20 and 18.20

vllm : Failed to infer device type