Connect with MongoDB on separate EC2 Instance

  • You need to open mongoDB port to world so that you can listen inbound traffic. To do so:
    In instance security group -> Inboud Open 27017 port or whatever port on which your mongoDB is currently running.

    Type             Protocol  Port          Range Source
    Custom TCP Rule     TCP       27017
    Custom TCP Rule     TCP       mongoDB_port  your_ip/CIDR

    Amazon FAQ about CIDR

  • In /etc/mongod.conf which is now default configuration file for mongoDB.
    Change binIP: to
    By default it listen to local host.

    # network interfaces
      port: 27017
  • Run this command to reflect changes:

    sudo service mongod restart

I am Senior Software Engineer. I love reading, writing, sharing,developing, hiking, movies, trips, mountains, brooks, hills etc.

Tagged with: , , ,
Posted in amazon, EC2, mongodb, mongoid

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: