When there is a connection problem with an instance in AWS, a "network error connection timed out" will occur.
As part of our Server Support Services, we have helps customers fixed AWS related issues for our customers.
In this context, we will look into why it occurs and how to fix it.
This is a connectivity issue that affects the AWS instance in question. It simply means that a request made to the Instance is not successful and thus times out.
Firewall restrictions or when SSH client is not active can obstruct access to the instance and results in network error.
Blocked port can also trigger this error.
We can fix this error via different approaches. Lets look at them briefly;
From the AWS manager console, start a session and restart the SSH service to disable the firewalls. You can use the commands below;
sudo iptables -F
sudo service sshd restart
Also confirm that port 22 which is SSH default port is open. To confirm this, use the command below;
sudo netstat -tnlp | grep :22
Next, you can terminate the session and you should be able to connect to the instance via SSH.
Follow the following steps to apply an ssh rule for inbound connection to EC2;
i. Go to the EC2 console.
ii. Next click on "Instances" from the left side of the window and select it.
iii. You will see the Security Groups in the Description tab. Click the group link there.
iv. Click on the "Edit" button in the Inbound tab.
v. Now you can apply the rule by clicking on "Add Rule" and then select SSH as the type. For the Port choose Port Range 22 and Source Anywhere.
You can connect to the instance via an SSH tool such as putty.
Up to date steps we used to fix "network error connection timed out" error in AWS.