I've never had a problem using SSH to access AWS EC2 instances and usually don't even need to include the key pair. In this example my EC2 instance is in a Custom VPC yet also in a public subnet with an IGW. It took hours just to get to the point now where when I SSH it asks me for my key pair's password. I've never been asked for a password before during SSH and have read a lot on here that doesn't seem to apply.

The command I run that asks for the password is:

ssh "2018-key.pem" ec2-user@XXX.XXX.X.XXX

I then get the following prompt:

root@2018-key.pem's password: 

However, I can use the same key pair to launch and access public EC2 instances via SSH. Any help would be sincerely appreciated.

1 Answer 1


It looks like you're missing a command line flag, -i. ssh is interpreting 2018-key.pem as an IP address. Try this:

ssh -i 2018-key.pem ec2-user@XXX.XXX.X.XXX

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.