Simple Python TCP server not working on Amazon EC2 instance

Question:

I am trying to run a simple Python TCP server on my EC2, listening on port 6666. I’ve created an inbound TCP firewall rule to open port 6666, and there are no restrictions on outgoing ports.

I cannot connect to my instance from the outside world however, testing with telnet or netcat can never make the connection. Things do work if I make a connection from localhost however.

Any ideas as to what could be wrong?

Answer:

Your TCP_IP is only listening locally because you set your listening IP to 127.0.0.1.
Set TCP_IP = "0.0.0.0" and it will listen on “all” interfaces including your externally-facing IP.

Leave a Reply