'Can't connect to my MongoDB EC2 instance via NodeJs
We have a EC2 MongoDb 4.0.1 instance with NodeJs 8.11.3, when I try to get access to my remote MongoDb I get a TimeOutError.
var url = "mongodb://admin:[email protected]:27017";
MongoClient.connect(url, (err, database) => {
if (err) return console.log(err);
db = database.db(dbName);
app.listen(3000, function() {
console.log("listen 3000");
})
});
I already set up a admin, comment out the bind_ip field in the mongo.conf file and set a inbound rule for the 27017 port in the security group.
Then I want to connect locally via "mongodb://admin:[email protected]:27017"
I got a "failed to connect to server ... " Error.
Any suggestions and how to fix it ?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
