Unable to connect to "aws-server": Connection timed out.

0

I periodically receive the error that roughly translates to "Unable to connect to "aws-server": Connection timed out." ( I'm receiving this error in Italian) when trying to access a a g4dn.xlarge instance on VScode, although the instance remains in execution from AWS' control panel. This usually happens after the instance has been active and working for 30 mins to a few hours. The only way so far I've found to solve the issue is to arrest and subsequently restart the instance, which also means I have to stop all processes running. It doesn't seem like I am having internet connection issues either. Would anyone know how to solve this?

1 Answer
0

The error "connection timed out" you are getting generally indicates that the server didn't respond to the client before the time out was reached. The following are common causes for this error:

  • The security group or network ACL doesn't allow access.
  • There's a firewall on the instance's operating system.
  • There's a firewall between the client and the server.
  • The host doesn't exist.

You can check if the source IP is not changed if you are using any VPN or home network.

As you mentioned that you are usually getting this error when the instance is active for 30 minutes or few hours, this can also happen when the instance is observing resource contention for example if the memory or CPU consumption is high.

Concluding this answer, I would suggest you to verify the following for the “Connection timed out” error you are receiving:

1. The instance's IP address or hostname is correct.
2. The instance is passing its health checks (both the instance & system status checks).
3. The security group of the instance allows incoming traffic on TCP port 22 from your source IP address. Source IP address may change if you are using VPN and there are any changes on the VPN side.
4. The network ACLs of instance subnet allows incoming traffic on TCP port 22 and allow ephemeral port for the outgoing traffic.
5. The route table of the instance’s subnet is configured properly to provide connectivity between EC2 instance and the SSH client.
6. There isn't a firewall at the OS level blocking the connection between SSH client and the EC2 instance.
7. The instance has enough resources available to serve the client request and is not in hung state. You can check instance screenshot for any error message, CloudWatch graph for status checks and CPU Utilization (also memory metrics if CloudWatch agent is configured).
8. When the instance is available and you are able to connect, check the OS level logs depending on the OS distribution you re using for further troubleshooting. You can mainly verify if there was any issue with the instance from the logs such as messages/syslog log file.

You can also follow the AWS Document here to troubleshoot such errors when connecting to the instance.

AWS
SUPPORT ENGINEER
Tarun_S
answered a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions