I cannot SSH

Hi I created keypair in EC2 instance and dowloaded it and save it my directory, when I ssh

ssh -i "C:\Users\myuser\.ssh\Myawskeypair.pem" ubuntu@ip.compute-1.amazonaws.com

I get permission denied. I just followed the docs when I Launch the instance.

I don’t know how to fix.

Thank you in advance.

Is ec2-ubuntu the username you were logged in as when you created the key pair?

Are you sure youve downloaded the private key and not the public key?

sorry I change now it is ubuntu as username, yes I downloaded the private key

So does it work now with the correct username?

Nope still having problem. I tried also root but no luck

Well there is a user that you were logged in as when you crated the key. That’s the user you need to use to log in to the machine, because the key is bound to that user. You cannot use the key to log in with other usernames.

Even I used the connect button in the instance dashboard this is the error

There was a problem setting up the instance connection

Log in failed. If this instance has just started up, try again in a minute or two.

Oh I’m In now :slight_smile:

1 Like