I created a new instance (tiny, 64 bit AMI linux from Amazon)
Created a new key pair called "mir".
I downloaded mir.pem
and put it in my ~/.ssh
folder.
I even did ssh-add mir.pem
.
Then I tried to ssh ubuntu@public_DNS_from_amazon
Why doesn't it work!?
Try
ssh [email protected] -i your-private.key
, instead ofssh-add
ing the key.Oh, and make sure you allowed TCP port 22 through the Security Group.
Does the security group (firewall configuration) allow SSH access?
More specifically - on the AWS management console page, select Security Groups in the left panel (towards the bottom) On the bottom-right panel, select "Inbound" tab, and make sure "Custom TCP rule" is selected. Enter 22 for the port number, click the "Add rule" button, then the "apply rule changes" button. No need to restart or reboot your instance, just need to enable TCP port 22 inbound
Try using either root or ec2-user as the username.
You need to open the ssh access to you instances with a
ec2-authorize default -p 22
command. Have you done this?This has been happening to me on some of my EC2 boxes. In general, it appears that if a process is taking all the processor or is behaving badly and you get disconnected, SSH might not be able to pick up when you try to reconnect. Rebooting the box through AWS console often helps.
It is also possible to launch an instance without associating it with a keypair. You might double check that when you launched your instance, you did so with the keypair you intended. If the instance launched with the wrong keypair, you'll need to relaunch your instance.
Try
where the x's are your public ip
To login to your AMI box you use the
ec2-user
. This means you would use the following to login:ssh -i mir.pem ec2-user@public_dns
to login.