Mongodirector > Blogs

MongoDB-as-a-service in your own Amazon AWS account provides a MongoDB-as-a-service experience in your own AWS account. Experience the benefits of hosted MongoDB-as-a-service solution without giving up the control of running your own MongoDB instances.

1.  Security
Don’t expose your production database to the internet. I am a firm believer that databases should not be exposed to the internet unless absolutely needed. Restricting physical access to your database provides greater “defense in depth”. Lock down access to your database using amazon security groups
2. Cost
Now that the instances are running in your account you can buy reserved instances for them. On average this should save you about 30-50% over running with other hosted providers. If you have AWS credits that you can use you can essentially eliminate your MongoDB hosting costs.
3. Amazon VPC support
Bring your own account enables you to run your MongoDB instances in an Amazon Virtual private cloud (VPC). This has all the security advantages outlined in 1 but also enables you to connect your servers to your on premise network using VPN
4. Backups in S3
Your backups get stored in your own S3 account or as EBS snapshots in your own account. This provides for easy and secure storage

In the ‘Bring your own account ‘ model you get billed separately for the machines and for mongodb management. Amazon AWS bills you for the machines and will bill you for your MongoDB management.

The example below is a cost breakdown of running a Medium 2+1 replica set in your own AWS account. A Medium 2+1 replica set uses 3 instances - 2 AWS medium instances + 1 Micro (arbiter). The cost calculation includes machine cost & the EBS provisioned IOPS volume cost across all the three machines. This cost calculation also assumes reserved instances. 

Number of instances : 3
AWS Machine cost: $156 /month
MongoDB management cost: $122/month
Total cost: $278.24.

This is a cost saving of almost 30% compared to other mongodb hosting providers!

Custom IAM Policy templates
We provide custom IAM policy templates when you deploy MongoDB in your own AWS account. Check out this blog post for more details – “Configuring MongoDirector permissions on AWS using a custom IAM policy template“.

Step by Step instructions

1) Log into the console - Log into the console at Click on the machine pools tab at the top right of the console. In the Machine pool tab click on the “create” button in the action bar.

2) AWS account – The first step in the Create Machine pool wizard is to enter your API and Secret keys from your AWS account.

3 )Region –  Select the AWS region for the Machine pool.

4 ) Access policy – This is a very important selection for the security of your MongoDB instances. It controls who can access your instances. There are two possible options
a)Internet –  This exposes your mongo instances to the internet
b) Security groups – You can pick the security groups in your account that have access to your mongo instances.
For your production instances you would only give the security group containing your front end servers access to the mongo databases. You can also change this setting later after you create the machine pool.

5) Name – Enter a name for the machine pool.

6) Once the machine pool is created it can be used as a target for the deployment of new instances.

  • Pingback: Getting started with MongoDB on AWS using MongoDirector()

  • Phyrom Ph

    Thank you Dharshan for your article. With regards to the data storage for MongoDB, would it be a case that we can use AWS S3 as database storage? The reason is that we want a cheaper operating expense as we do multi-tenant databases; therefore, there is no multiple concurrent access to the same data by so many users.