Connection Time Out in AWS EC2
Possible reasons for timeout when trying to access EC2 instance
- The most likely one is that the Security Group is not configured properly to provide SSH access on port 22 to your i.p.
- The local firewall configuration does not allow SSH access to the server.
- The server is not started properly
- Net connectivity
- Wrong pem file / Host Name
- Spelling mistake
When it times out or fails, check the following:
Make sure to have an inbound rule for tcp port 22 and either all ips or your ip. You can find the security group through the ec2 menu, in the instance options.
For a new subnet in a vpc, you need to change to a routing table that points 0.0.0.0/0 to internet gateway target. When you create the subnet in your vpc, by default it assigns the default routing table, which probably does not accept incoming traffic from the internet. You can edit the routing table options in the vpc menu and then subnets.
Add Route to Routing Table
Target: <Internet Gateway from earlier>
For an instance in a vpc, you need to assign a public elastic ip address, and associate it with the instance. The private ip address can’t be accessed from the outside. You can get an elastic ip in the ec2 menu (not instance menu).
Make sure you’re using the correct username. It should be one of ec2-user or root or ubuntu. Try them all if necessary.
Make sure you’re using the correct private key (the one you download or choose when launching the instance). Seems obvious, but copy paste got me twice.
Alternatively, Building everything back. This included:
- Create VPC
- Create Internet Gateway
- Attach Internet Gateway to VPC
- Create Routing Table
- Add Route to Routing Table
- Create Subnet
Best Open Source Business Intelligence Software Helical Insight is Here