Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I set up a free Amazon EC2 instance in order to use a Node app outside of my localhost environment.

The instance is allocated a public IP address at launch, mine for example being Does this mean that if, within my launched Node program on the EC2, I'm listening for connections at http://localhost:8080, the server is listening for the connections at ?

Or is there more to it than that?

share|improve this question
up vote 9 down vote accepted

No, listening sockets on localhost ( or ::1 on IPv6-enabled systems) are only accessible from the very same system they were created on.

To configure a program to listen on all interfaces, you'd usually use or ::. According to a quick Google search this should also be valid for node.js.

share|improve this answer
Thanks man. I'll accept this when time's up. – user317572 Apr 22 '14 at 21:35
Note that it's often considered best practices to not use, as the are frequently not "future-proof". That said, though, better than 9 times out of 10 it isn't really a problem, just keep it in mind if you later add a second IP and then wonder why a second web server can't start up on it. – Kromey Apr 22 '14 at 21:55
That’s certainly true. However, for dynamic IP setups like EC2, there’s simply no other easy way. – Daniel B Apr 23 '14 at 5:22
Also it's worth to mention that if your app is configured to listen on, there still can be firewalls, like iptables which block the port for the outside world, or in your case, there is definitely a firewall between your EC2 instance and the outside world, in which you have to enable forwarding to the port in the Amazon management console. – r1pp3rj4ck Apr 23 '14 at 9:39

You must log in to answer this question.