1

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?

  • The command you executed is to flush the Linux firewall rules. Usually, Cloud instances won't have rules that block port 22. What AMI are you using? Have you done any additional modification to the instance? – Ranjandas Sep 10 '20 at 07:27
  • it is Canonical, Ubuntu, 18.04 LTS, amd64 bionic image build on 2020-01-12 – Sreejith Sasidharan Sep 10 '20 at 07:29
  • Are you connecting from a stable internet connection? How did you determine that the server is actually down after entering the command (couldn't it be that you lost the connection to the instance and server is still alive)? Do you see anything in the instance system log? (RighClick Instance > Instance Settings > Get System Log) – Ranjandas Sep 10 '20 at 08:39
  • My internet connection was good. The site went down after I run that command. my colleague from another location reported that the site is down. I will check the system log after I run the command again. – Sreejith Sasidharan Sep 10 '20 at 09:19
  • The site went down after i run the command from the system manager console. but there is nothing added to the system log after I executed the command. – Sreejith Sasidharan Sep 10 '20 at 10:28
  • Do a traceroute - confirm the public IP address. Once you've done that, ensure that your VPC has no Network ACL Deny Rules, Check the Security Group in AWS to see if Inbound Connections are allowed from that port 22. – dellyjm Sep 11 '20 at 03:22

1 Answers1

1

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
John Rotenstein
  • 821
  • 6
  • 16