connect to mongodb on separate ec2 instance connect to mongodb on separate ec2 instance express express

connect to mongodb on separate ec2 instance


All looks correct here, you do correctly open port 27017 on the mongoDB instance. Also, you may want to try and kill the original mongod server process, and restart it explicitly pointing to your config file so that it knows to use those settings. Something like the following should accomplish this (assuming your on a linux machine and your config file is in the default folder)-

sudo kill mongod PID

and then

sudo mongod --fork --config /etc/mongod.conf