Amazon AWS communication of instances in VPC Amazon AWS communication of instances in VPC express express

Amazon AWS communication of instances in VPC


Your setup should be in following way

1) Open 80 or 443 port on security group which is assigned to Nginx server.2) open custom TCP port 3000 on security group assigned to javascript server(Express). Allow your traffic on port 3000 either from nginx machines private ip or for Security group assigned to nginx machine (AWS console allows this)3)Finally again open port of nosql DB on security group assigned to DB server and allow traffic from java script (Express) servers IP or java script servers security group.

Note: Please avoid allowing all traffic on 22 port in security group just for security reasons


It actually is working now, the configs were right all the time and I did not need a "appending a /". I just created a new Instance and copied all of the configurations into that new instance, but now everything seems to work fine. There were some setting problems since the beginning ....


Seems to me like a simple issue, wherein your nginx config for routing to express is wrongly configured. You have missed out appending a / at the end of proxy_pass directive because of which nginx will reroute to http://nodestest. Rewrite your nginx config to this

upstream nodes{    server PRIVATE_IP:3000;    keepalive 8;}server{    listen *:80;    location / {        proxy_pass http://nodes/; //appended forward slash        proxy_redirect off;        proxy_set_header X-Real-IP $remote_addr;        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;        proxy_set_header X-Forwarded-Proto $scheme;        proxy_set_header Host $host;        proxy_set_header X-NginX-Proxy true;        proxy_set_header Connection "";        proxy_http_version 1.1;    }}

Once the config change has been made reload nginx using the command sudo service nginx reload