Connecting to EC2 instance:Permission denied (publickey) error
September 22, 2011 § Leave a comment
You connect to your Ec2 instance by:
ssh -i private.pem {user}@{ip}
Where:
private.pem is your Amazon key pairs file
user is the login name, this is the problem usually, and it’s NOT always root or ec2-user, different AMIs use different login name, so you really have to see the documentation for your AMI. for instance, Ubuntu releases by Canonical use the user ‘ubuntu’, where Ubuntu releases by bitnami use ‘bitnami’ as the default user.
ip is your instance public ip, could be like this ec2-xx-xxx-xxx-xxx.compute-1.amazonaws.com