Deploy MongoDB from AWS Marketplace

If you installed MongoDB via the AWS Marketplace, refer to the instructions below for Starting MongoDB. For information on how the MongoDB with instance-storage AMI was configured, see [#MongoDB AMI]. For information on how the MongoDB with EBS RAID storage was configured, see [#MongoDB with EBS RAID AMI]. The [#Security Setup] section contains information about the security group settings for these AMIs.

Starting MongoDB

The instance has been mostly configured, the only steps left are to set MongoDB to start at system boot and then start mongodb-manual:mongod up:

$ sudo chkconfig mongod on
$ sudo /etc/init.d/mongod start
Starting mongod:                                           [  OK  ]
forked process: 1234
all output going to: /log/mongod.log

In a few moments MongoDB will finish starting up and then you can connect to MongoDB using the mongodb-manual:mongo client:

$ mongo
MongoDB shell version: 2.0.4
connecting to: test

If you have trouble connecting to the MongoDB daemon, check the log file (either /var/log/mongo/mongod.log or /log/mongod.log) for mongodb-manual:mongod console output.

Security Setup

By default, the instance starts up with a newly created security group and that group specifies that only access via port 22 (SSH) is allowed. In order to make MongoDB accessible to other instances, you’ll need to add an additional rule to your security group specifying access to port 27017 along with a source (this can be a specific IP address, instances from within another security group or from an IP). Start by logging in to the AWS EC2 Management Console and navigate to the Security Groups section. Next, find the group that was created when you created your instance and add an Inbound Rule:


After the rule is applied, you will be able to access MongoDB running in your instance from the source you specified. Consult the AWS EC2 Security Groups documentation for more information about configuring access to your instance with security groups.

Instance Configurations


MongoDB was installed onto Amazon Linux using a subset of steps found in the Install and Configure MongoDB section of Install MongoDB on Amazon EC2. Specifically, the 10gen repository was created and MongoDB (along with sysstat tools) were then installed via yum. This AMI uses a single EBS-backed volume as storage and does not employ RAID10 or LVM. The data directory was set to /data in the MongoDB configuration file /etc/mongodb.conf.


Using the Install MongoDB on Amazon EC2 guide as a base, the EBS RAID AMI was configured using a subset of the steps found in the Deploy a Single Node section. This AMI was configured with block device mapping <> and uses 4 EBS volumes, each with 100GiB of storage.

The volumes were then setup as a single RAID10 device using mdadm and 3 logical volumes (data, log, journal) were created using LVM. With RAID10 the total available storage is 200GiB and within that 180GiB is for /data, 10GiB for /log and 10GiB for /journal. The MongoDB configuration file /etc/mongod.conf reflects the updated locations for these elements. For more information on the specific steps, refer to the Install MongoDB on Amazon EC2 guide.

More Information

For more information on deploying MongoDB on AWS (including advanced storage setups, backups, etc.), refer to the Amazon EC2 page or the Install MongoDB on Amazon EC2 guide.