So I just launched my ec2 instance : t2.micro with Ubuntu 14.04 OS. The security group has settings enabled for letting in inbound traffic from SSH ( port 22 ) and HTTP ( port 80 ). But when I try to reach the server from the browser via its public dns : ec2-52-74-136-74.ap-southeast-1.compute.amazonaws.com it says connection refused. And if I try to ssh it says : Permission denied (publickey). Any ideas?


That machine is up and responding on 22. Have you added your SSH key into your agent?

ssh-add -l

should show it listed. Don't forget to ssh as ubuntu@

  • So stupid of me. Yes the pem file was not in the agents list. Thankyou. – roopunk May 21 '15 at 14:04
  • So I used to connect with my earlier ec2 instance but I had configured the ssh key in the ~/.ssh/config file instead of adding it as an agent via ssh-add. But that config was for my old machine's IP, and therefore wasn't working for my new ec2 credentials. – roopunk May 21 '15 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.