SSH connection getting a Connection timed out in AWS

amazon-web-servicesaws-cliaws-systems-managerssh

I have a website hosted in AWS EC2 with the t2.micro instance(Ubuntu 18.04.4). When I tried to connect through Putty or browser-based SSH connection from the AWS console, i am getting a connection timeout error. I tried using the instructions in the following link to fix it, but the console is stuck after I run the first command sudo iptables -F. also my server goes down. then i have to reboot the instance from the AWS console.

Also I have added CloudFlare for this server, is it a cause of this problem?

https://aws.amazon.com/premiumsupport/knowledge-center/ec2-linux-resolve-ssh-connection-errors/

How do I resolve this problem?

Best Answer

A timeout is an indication that network traffic is not getting to the instance (as opposed to an authentication error).

If you are trying to connect to an Amazon EC2 Ubuntu instance from your own computer on the Internet, confirm the following:

  • The instance has been launched in a public subnet (defined as a subnet that has a Route Table pointing to an Internet Gateway)
  • The Security Group associated with the EC2 instance is permitting inbound access on port 22 (SSH) from your IP address or from 0.0.0.0/0
  • You are connecting to the Public IP address of the EC2 instance
  • The Network ACLs on the subnet have not been changed from their default "Allow All" configuration
Related Topic