Command Line Asking for Key Password when SSH into EC2

-1

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.

Matt

Posted 2017-12-26T17:33:33.940

Reputation: 1

Answers

2

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

trapezoid

Posted 2017-12-26T17:33:33.940

Reputation: 177