Niel Niel - 1 month ago 18
Node.js Question

AWS EC2 instance access internal server

In my Amazon EC2 instance I have a Pyramid server as well as a NodeJS server running. The NodeJS server acts as the frontend and I updated my security groups so I can use the public DNS to view the page.

The Pyramid server acts as a backend and the frontend accesses it by

http://0.0.0.0:8002/
. But when I do an http call to the backend I get a
Failed to load resource: net::ERR_ADDRESS_INVALID
error message.

Do I need to add a rule to the security groups, or update the iptables, or something?

Answer

If both of these services are running on the same server, you shouldn't be sending network traffic out of the server and back, so security groups will not be an issue here.

The question is, why are you using 0.0.0.0 here? I think you probably configured the Pyramid server to listen on 0.0.0.0, which really means "listen on all IP addresses". However you need to be using http://127.0.0.1:8002/ or http://localhost:8002/ in order to connect to the service from another service running on the same server.