Possible reasons for timeout when trying to access EC2 instance

Solution 1:

I had the same problem, and the solution ended up being adding my local machine's IP to the list of inbound rules in the active security group. In the inbound dialog below, enter 22 in the port range, your local IP/32 in the source field, and leave 'custom tcp rule' in the dropdown.

enter image description here

Solution 2:

Did you set an appropriate security group for the instance? I.e. one that allows access from your network to port 22 on the instance. (By default all traffic is disallowed.)

Update: Ok, not a security group issue. But does the problem persist if you launch up another instance from the same AMI and try to access that? Maybe this particular EC2 instance just randomly failed somehow – it is only matter of time that something like that happens. (Recommended reading: Architecting for the Cloud: Best Practices (PDF), a paper by Jinesh Varia who is a web services evangelist at Amazon. See especially the section titled "Design for failure and nothing will fail".)

Solution 3:

Destroy and create anew

I had one availability zone where I could connect and another where I could not. After a few hours I got so frustrated that I deleted everything in that availability zone.

Building everything back I had to make sure to create EVERYTHING. This included:

  • Create VPC
    • CIDR: 10.0.0.0/24
  • Create Internet Gateway
  • Attach Internet Gateway to VPC
  • Create Routing Table
  • Add Route to Routing Table
    • Destination: 0.0.0.0/0
    • Target: <Internet Gateway from earlier>
  • Create Subnet
    • CIDR: 10.0.0.0/24
    • Routing Table: <Routing Table from earlier

It took me a LOT of fumbling to get all of this. I've ordered the steps in the way I think might be most efficient, but you may have to adjust them to get one item available for the next.

Suggestion

I'm not suggesting that you go thermo nuclear as I did. I'm offering all this information so that you can check these associations to ensure yours are appropriate.