we have an EC2 MongoDB 2.4 instance from Amazon MarketPlace. when i try to access it from my computer using the mongo command like so:
mongo xx-xx-xx-xx-xx.compute-1.amazonaws.com
i get the following error
Error: couldn't connect to server xx-xx-xx-xx-xx.compute-1.amazonaws.com:27017 at src/mongo/shell/mongo.js:147
exception: connect failed
any suggestions on how to fix this?
MongoDB can be installed on Amazon EC2 or deployed using the AWS Marketplace. First, you will need to get your deployment planning and set up the single production node. This will be followed up with setting up a place for storage before getting your MongoDB instance running.
MongoDB can be managed remotely or connected to a separate application server by making a few changes to the default configuration. First, we'll install the MongoDB using the docker container, then configure the MongoDB installation to access from a trusted remote machine securely.
As frisky said, you have to open the port 27017 at the EC2 Security Group Console. (To know more about how to do that: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/authorizing-access-to-an-instance.html)
But you also need to change the bind_ip
variable at the /etc/mongodb.conf file. You need to comment the line or assign the ip that will be able to connect the DB to it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With