Gulvan
Gulvan

Reputation: 315

Connection_timed_out when trying to connect to AWS EC2 tcp port (not rdp)

I'm trying to launch a socket server on Amazon EC2. It binds the socket to 0.0.0.0:5000 and then listens on this port, printing every incoming message

However, when I simply try to connect to ec2-18-x-x-x.us-east-2.compute.amazonaws.com:5000 via Chrome, it throws an error: ERR_CONNECTION_TIMED_OUT. Of course, when I try to connect to it with a client using socket.connect(), a client is also unable to set up a connection.

I've already added the port to the security group inbound rules like that:

enter image description here

netstat -a shows that this port is open: enter image description here

I use the public DNS IPv4 address, that is stated in instance description.

As I've successfully launched the server and tested netstat, it's obvious I can connect to EC2 using RDP.

Guided by this troubleshooting manual, I've also checked the route table for subnet and ACL for subnet, but everything was OK.

What's the problem then?

Upvotes: 1

Views: 4125

Answers (1)

Mark B
Mark B

Reputation: 200617

netstat is simply showing that some process is listening on that port, not that the port is "open". You still need to open port 5000 in the Windows firewall.

Upvotes: 1

Related Questions