4
votes

I am having trouble connecting to aws ec2 instance. Here are the details.

Instance Details

AMI: ubuntu/images/ebs/ubuntu-quantal-12.10-amd64-server-20121218 (ami-422ea672)
Zone: us-west-2b
Security Groups: dev. view rules
Type: t1.micro

Security Group

Ports    Protocol     Source    
0-65535     tcp          0.0.0.0/0  
0-65535     udp          0.0.0.0/0  
-1          icmp         0.0.0.0/0  
22          tcp          106.76.139.164/32  

I have also added my local ip range in inbound tcp rules for ssh.

Error Message

    debug1: Reading configuration data /etc/ssh/ssh_config
    debug1: /etc/ssh/ssh_config line 19: Applying options for *
    debug1: Connecting to ec2-54-245-168-248.us-west-2.compute.amazonaws.com [54.245.168.248] port 22.
    debug1: connect to address 54.245.168.248 port 22: Connection timed out
    ssh: connect to host ec2-54-245-168-248.us-west-2.compute.amazonaws.com port 22: Connection timed out

I can successfully ping the instance. I have initiated ssh connection before on my older account and I faced no problems.

** Things that I have already tried **

  • Terminating and Creating a new instance. Didn't work!
  • Opening all TCP, UDP, ICMP connections. Didn't work!
  • Associating an elastic IP and using Elastic IP for connection. Didn't work.
  • Deleted ssh config file. Didn't work.
3
is 106.76.139.164 still your ip address? - datasage
i change it to my current ip every time i try to connect. - R Simon
The error indicates that you are not getting a response from the instance. Which often means 1. bad security group settings. 2. Connecting to the wrong ip address. 3. In some cases the instance was unable to boot. - datasage

3 Answers

3
votes

I also had this problem due to the fact that my ISP had given me a new IP, with the effect that the Security Group settings for ssh access to my instance being outdating. Updating the allowed IPs in the Security Group to reflect this change fixed the issue.

1
votes

I am sorry. It is because of my ISP.

0
votes

I had the same problem and I figured out that it was because the rules related to my security group was not allowing me to SSH to my instance. For solving this problem:

  1. log into your aws account and select EC2 from services.

  2. from the left-side column, under security and network, select security group.

  3. Click on "Action" > select "Edit Inbound Rules"

enter image description here

  1. for "Type" select SSH and for "Source" select anywhere. (leave other things as is)

  2. save and go to edit "outbound rules" and do exactly the same steps.

You should be fine now to SSH to your instance!