I ran into this problem earlier and had to do two things:

  • Run chmod 600 on the .pem file

$ chmod 600 ~/Downloads/example.pem

This allows the owner to read and write.

  • Prepend ec2-user@ to the host name

$ ssh -i path/to/example.pem ec2-user@ec2-an-ip-address.compute-1.amazonaws.com

Don’t forgot to prepend ec2-user@ to the host name once you’ve retrieved it from AWS console.

Comments