I have a MongoDB running on my local machine and another MongoDB running on the AWS EC2 instance where my express server and my angularjs web app is installed. That is:
On my local machine (Windows environment), running:
On AWS EC2 instance (ubuntu), running:
When I browse my web side running on AWS EC2 instance (using https://ec2_public_ip:3443/home/app/index.html), it retrieves data from the MongoDB running on my local machine. If I shut down the MongoDB and Express server on my local machine, I get Failed to connect to resource error. Why is my express server not connecting to the MongoDB running on AWS?
This is my connection string in the app.js file:
'mongoUrl' : 'mongodb://localhost:27017/myMongodatabase',
I also tried
'mongoUrl' : 'mongodb://0.0.0.0:27017/myMongodatabase',
Both did not work on my AWS instance.
I'm learning to use MongoDB, AWS, Express and now I am confused. Any help is appreciated.