This is probably a stupidly simple question to some :)
I\'ve created a new linux instance on Amazon EC2, and as part of that downloaded the .pem file to allow me to
In addition to the other answers, here is what I did in order for this to work:
cp key.pem ~/.ssh/key.pem
chmod 400 ~/.ssh/key.pem
eval `ssh-agent -s`
ssh-add
ssh-add ~/.ssh/key.pem
Now you should be able to ssh EC2 (:
What did it for me is editing the default security group to allow for inbound TCP traffic at port 22:
BY default permission are not allowing the pem key. You just have to change the permission:
chmod 400 xyz.pem
and if ubuntu instance then connect using:
ssh -i xyz.pem ubuntu@ec2-youraws.amazonaws.com
In Mac terminal, doing "chmod 400 xyz.pem" did not help me, it kept saying permission denied. For ubuntu users I would suggest
ssh-add xyz.pem
ssh -i xyz.pem ubuntu@ec2-54-69-172-118.us-west-2.compute.amazonaws.com
(notice the user is ubuntu)Key file should not be publicly viewable so use permission 400
chmod 400 keyfile.pem
If above command shows permission error use
sudo chmod 400 keyfile.pem
Now ssh into the ec2 machine, if you still face the issue, use ec2-user
ssh -i keyfile.pem ec2-user@ec2-12-34-56-78.compute-1.amazonaws.com
In windows,