I tried setting up a MongoDB 3-node replica set in OpsWorks a few months back. I will share a bit of my experience:
1) How to install a single MongoDB:
It is possible and easy to install a single mongodb using the EDelight Chef MongoDB Cookbook. Just add it as a submodule in your custom opsworks chef repository.
To get it to work create a custom layer and call it MongoDB and excecute the following recipes
- SETUP: mongodb:10gen_repo
- CONFIGURE: mongodb:default
This will install the latest version of MongoDB.
NOTE: I used Ubuntu instances.
2) MongoDB Best Practices
If you talk to MongoDB engineers or customer service reps, they will all tell you that the recommended setup for MongoDB is a 3 node replica set. This means one master and two read replicas hopefully in different availability zones. Also an ideal setup will have lots of RAM, to give you an example: the smallest instance provided by MongoDB that you can find in the AWS market place is a standard large:
You also have to consider using EBS on RAID10, maybe reserved IOPS...
See the white paper MongoDB on AWS for more info.
3) Security Considerations
Ideally you want only application instances to access the DB instances. In AWS you could create a security group with custom rules and assign EC2 instances to the group you just created... Is not quite like this when it comes to OpsWorks as it forces you to have default security groups that have very lax restrictions. AWS will always adopt lax permissions over stricter ones.
4) Time and Money Considerations
If the recommended setup is a 3 node replica set using large instances you are looking at at least $600 (on demand) for the DB and this doesn't add reserved IOPS, EBS, and so on. Automating this setup is possible yet not simple. It will take time or an expert in the subject to get you going. If you have the resources and personnel to deal with this go for it. If you are part of a small development team that want's to code more and do less operations, read on.
5) Find a reliable Managed Solution
At first I was reluctant to the idea of using a third party company that offered MongoDB as a service. After much evaluation of the different options (Managed, AWS Marketplace, OpsWorks, Direct EC2 installation), I concluded that for our small team the best thing to do was to use either MongoLab or MongoHQ. They host and mange MongoDB instances of all sizes and prices. They even let you choose the hosting (AWS, Rackspace, etc), region and AZ. Price wise will be more expensive if you look at the hardware alone, but like I mentioned before you have to consider not only the price but the operational time MongoDB will require.
I have been there, done that, and ended up not using OpsWorks to host MongodDB. Hopefully this will save you some time and headaches.