3

I am having a problem connecting with my Ubuntu 16.04 ec2 instance on aws. I have added my public key to authorized keys file and also added my ip for ssh access on port 22 using Myip.

I am trying to connect using normal way:

ssh ubuntu@aws-instance.com

I have even rebooted my ec2 instance.

What else do I need to do to get access?

Thanks

Maverick
  • 131
  • 1
  • 1
  • 4
  • That command line doesn't appear to use your private key, unless you've done that some other way. However timed out usually means a firewall type issue, security group, network ACL, or a local issue. Perhaps try ssh'ing from an AWS spot instance. – Tim Mar 14 '18 at 19:25

5 Answers5

5

Normally, to solve ssh connection issues in aws you can check the following things:

Check if your instance is up.

Allow 22 port in security group: check if the security group you have edited is assigned to instance. Also, only for test allow 0.0.0.0/0 (all ips) to 22 port.

Check if your AMI has ubuntu user, you can try with user admin too.

Check if the ip of the instance is public.

If all of this is correct, the problem probabilly will be in the pair public-private key. Look up with pair you use when you launch the instance and your default key is the rigth key.

JDaniel
  • 81
  • 5
0

option 3 if you are on a VPN and the ip is private, use an elastic ip address to make it public by associating it with the running instance

f3tech
  • 1
0

i was using amazon EC2 many months without issues but recently i am getting this too. i am using Google public DNS as my DNS, not sure if it is related. i am also not sure if the problem began with my new internet connection or not, i guess it worked for a while even with new internet.

Btw i tried the public IP instead of domain name and no change.

Problem also is, that you have to do many tries and one of them eventually works...

luky
  • 219
  • 1
  • 4
  • 12
0

If you have a route table that has routes to Internet Gateway, then associate the route table with your public subnet

Jose Mhlanga
  • 101
  • 2
0

This could be a DNS issue. Try to put the IP address of your EC2 instance instead:

ssh -i <your_pem_key> <username>@<ip-address>
wintermute
  • 101
  • 2