I setup the VPC as described here: http://docs.amazonwebservices.com/AmazonVPC/latest/UserGuide/VPC_Scenario2.html
And I have a box in the private subnet, that I want to use as a mongo box. The private IP is 10.0.1.51.
I can connect to mongod instance over localhost, but not over the private IP:
ubuntu@ip-10-0-1-51:~$ mongo localhost
connecting to: localhost
> this works
> ^Cubuntu@ip-10-0-1-51:~$ mongo 10.0.1.51
Fri Sep 21 02:23:18 Error: couldn't connect to server 10.0.1.51 shell/mongo.js:81
exception: connect failed
ubuntu@ip-10-0-1-51:~$
The security group allows incoming and outgoing port 27017.
The route table has
10.0.0.0/16 local
entry.
What am I missing?
The problem was actually in mongodb config, not the routing tables. MongoDB, like MySQL, needs to allow connections from a specific host.
In mongodb.conf:
Where
@bind_ipand@portare the IP and port of your server as it appears to the client nodes.