I am new to Google Cloud, but I have followed all the steps below by looking at some documentations and forums. Not sure if I am missing anything with the configuration or what. Any help would be appreciated
Not sure what is happening. I have tried all help from other posts from stackoverflow and google groups as well. But nothing seems to change for me. It could be simple that I am not looking at?
I've tried to follow your steps and found no issues.
Please have a look at the commands below:
create test VM instance;
download PuTTY and PuTTYgen ;
follow the documentation and generate SSH keys:
Click Generate and follow the on-screen instructions to generate a new key. For most cases, the default parameters are fine, but you must generate keys with at least 2,048 bits. When you have finished generating the key, the tool displays your public key value.
In the Key comment section, replace the existing text with the username of the user for whom you will apply the key.
Optionally, you can enter a Key passphrase to protect your key.
Click Save private key to write your private key to a file with a
.ppk
extension.Click Save public key to write your public key to a file for later use. Keep the PuTTYgen window open for now.
follow the documentation Adding or removing project-wide public SSH keys to add public key project wide at the Metadata page:
Use project-wide public SSH keys to give users general access to a Linux instance. Project-wide public SSH keys give users access to all of the Linux instances in a project that allow project-wide public SSH keys. If an instance blocks project-wide public SSH keys, a user can't use their project-wide public SSH key to connect to the instance unless the same public SSH key is also added to instance metadata.
or follow documentation Adding or removing instance-level public SSH keys to do it at the instance level:
Instance-level public SSH keys give users access to a specific Linux instance. Users with instance-level public SSH keys can access a Linux instance even if it blocks project-wide public SSH keys.
add private key to PuTTY and connect to VM instance using username you use at the Key comment section while generating the key, I was able to reproduce your error by using any other username at this step.
In addition, have a look at the OS Login feature:
OS Login lets you use Compute Engine IAM roles to grant or revoke SSH access to your Linux instances. OS Login is an alternative to managing instance access by adding and removing SSH keys in metadata.