MongoDB can be installed and self-managed on-premise, in a cloud, or used, through MongoDB Atlas, in the database-as-a-service mode in all three major public clouds (AWS, Microsoft Azure, Google Cloud Platform).
This article will explain the two options for running MongoDB on AWS, so you can determine which is best to meet your needs.
There are two ways to run MongoDB on AWS:
Use MongoDB Atlas, a fully managed, database-as-a-service (DBaaS) platform managed and administered by MongoDB
Install and self-manage MongoDB yourself using the community or enterprise edition
The following sections explain the basics of how to get started, answer common questions, and present the pros and cons of each choice.
The fastest way to get started building with MongoDB on AWS is to use MongoDB Atlas, MongoDB’s database-as-a-service offering.
In some clouds, a virtual machine is called an instance. MongoDB Atlas uses the word cluster to refer to a database deployed by a user.
MongoDB Atlas is a fully managed version of MongoDB in the cloud. This means that developers and operations teams don't have to spend their time on manual database administration work. Developers can use it without having to worry about time-consuming details.
Further, MongoDB Atlas is not only a productized version of MongoDB running on a cloud platform, but it also offers a much larger set of services and capabilities that are all integrated, operated, and maintained by MongoDB engineers and operational staff.
MongoDB Atlas provides a quick way to get started (using the M0 cluster that is free forever), but also provides Atlas Search, Global Replication, multi-cloud support, continuous backup with snapshot support, data encryption, charts, Realm for building mobile applications, and a wide range of features needed by modern applications.
So, to understand whether MongoDB Atlas is right for you, we will explain the basics as well as the layers of capabilities that have been added to MongoDB Atlas so you can see which ones are relevant to your needs.
In the self-managed model, to run a database you must:
Then you can get started on programming.
Using the self-managed database, will then require:
In the DBaaS model, the vendor can take care of these repetitive, mundane tasks.
The DBaaS model transfers responsibility from the users of the database to the company that runs the service.
The user of a DBaaS will only have to handle:
The subscription fees for a DBaaS pay for your usage and for all the tasks related to running and administering the database.
The vendor performs these services at scale (and of course knows the database inside and out) so the vendor usually can do it all far cheaper than it would cost most companies to do them by themselves.
The economics and convenience of the DBaaS model have made it a popular choice among developers, who want to focus on coding and not on the details of running a database.
If you want to quickly get started as an individual or a team, MongoDB Atlas starter clusters are the way to go.
The M0 clusters (Free Tier): Starter clusters for teams learning MongoDB or developing small applications. This type of cluster is free for anyone to use.
The M2 and M5 clusters: Shared clusters for applications that need more storage capacity (2 GB and 5GB respectively).
For applications that need even higher performance, Atlas is available in dedicated MongoDB clusters. These clusters have increasing amounts of storage, memory, and CPU power:
The M10 and M20 are dedicated clusters for low traffic applications.
The M30 through M700 tiers are dedicated clusters for high traffic applications and large datasets.
The Cluster Tier page provides a summary of all cluster types for MongoDB Atlas, including pricing.
The Create a New Cluster page provides step by step instructions.
While the MongoDB database that powers MongoDB Atlas is the same database that is at the foundation of MongoDB Community Edition and MongoDB Enterprise Server, new advanced capabilities have been added, including:
MongoDB Atlas Search: The Lucene full-text search engine has been integrated into Atlas to provide rich search capabilities.
MongoDB Charts is a built-in tool to create and share visualizations of your MongoDB data.
Encryption at Rest Using Customer Key Management: All data in MongoDB Atlas is encrypted. With Encryption at Rest Using Customer Key Management users can configure an additional layer of encryption on their data using their Atlas-compatible customer key management provider with the MongoDB encrypted storage engine.
The Data Explorer is Atlas’s built-in tool to view and interact with your data, supporting the ability to manage databases, collections, documents, indexes, and other functions.
Within a public cloud, MongoDB Atlas supports Cross Region Replication which allows a database to have active replicas in data centers in multiple geographies, increasing reliability in the event of catastrophic events or other outages.
Global Clusters support low-latency reads and writes by storing data at the location nearest to its use. For example, data created on the East Coast of the U.S. may be stored in a data center in Virginia while data created on the West Coast may be stored in California.
Because MongoDB Atlas is a cloud database, it can be used as a platform for new types of development and data management techniques:
MongoDB Stitch is a serverless platform that enables developers to quickly build applications without having to set up server infrastructure. Stitch is built on top of MongoDB Atlas, automatically integrating the connection to your database.
MongoDB Atlas Triggers allow you to execute server-side logic in response to database events or according to a schedule. Atlas provides two kinds of triggers: database and scheduled triggers.
MongoDB Atlas Data Lake (in beta) enables you to query data stored in your AWS S3 buckets using the mongo shell, MongoDB Compass, or any MongoDB driver.
MongoDB takes advantage of the properties of public clouds to increase automation and reliability:
For M10 clusters and above, MongoDB Atlas offers Cluster Autoscaling, automatically scaling a cluster’s tier, storage capacity, or both in response to cluster usage. Cluster auto-scaling removes the need to write scripts or use consulting services to make scaling decisions. To control costs, you can specify a range of cluster tiers to which your cluster can automatically scale.
MongoDB Atlas Live Migration allows an existing MongoDB database to be migrated and synchronized to a MongoDB Atlas version of the database. This Guide to MongoDB Live Migration explains the steps for migrating a database installed on AWS to MongoDB Atlas.
The Real Time Performance Panel (RTPP), available for M10 and larger clusters, monitors and displays current network traffic, database operations on the machines hosting MongoDB in your clusters, and hardware statistics about the hosts. You use RTPP to visually identify relevant database operations and evaluate metrics like query execution times and the ratio of documents scanned to documents returned. You can also monitor network load and throughput, and discover potential replication lag on secondary members of replica sets.
MongoDB Atlas provides methods to back up and restore cluster data, including snapshots that take advantage of cloud provider capabilities as well as point-in-time recovery.
MongoDB Atlas has advanced security controls with a full range of features including robust database auditing, integration with Active Directory and LDAP, and the ability to encrypt data using your own key.
While MongoDB Atlas streamlines many mundane tasks of database management, there is an option of manually setting up, and installing a MongoDB environment on AWS.
Installing any software on an operating system requires advanced knowledge of both the operating system and the software itself.
Users are encouraged to try MongoDB Atlas' free tier, available on AWS, but there are some cases where running a self-managed version for an existing cloud database or application may make the most sense.
Some common scenarios are:
Developers or companies that are currently set up to run installed, self-managed software and all of the operational tools are oriented to running in that mode.
If an application running on an earlier version of MongoDB is heavily customized or deeply integrated with other tools. On the other hand, it’s also worth considering a live migration.
Installing and running a database in self-managed mode temporarily helps deepen the understanding of how the database works and what parts of the operating system support it. Keep in mind, you'd want to consider migrating to MongoDB Atlas before your application grows to the point that it becomes more difficult to migrate over. And again, you can easily get started with our free tier of MongoDB Atlas, and deploy a cluster within a few clicks.
The team responsible for the MongoDB cluster must:
Many of the tasks of running one or more MongoDB clusters on AWS can be streamlined and automated using the MongoDB Cloud Manager, which helps:
Visualize the health of your MongoDB clusters
Monitor your MongoDB deployments
Alert you to any issues
Manage cloud backups, along with point-in-time recovery
Automate deployment and growth in line with your defined best practices
AWS itself has a variety of operational tools and consoles that also help manage the infrastructure needed to support MongoDB.
Here are a few scenarios to consider: - If you are just getting started and haven’t done anything with MongoDB, the MongoDB Atlas M0 starter cluster is the fastest way to create a database and start coding.
If you are planning on adopting MongoDB as a platform and are new to AWS, MongoDB Atlas is a quicker way to get started.
If you are building a modern application, MongoDB Atlas provides a lot of advanced capabilities and integrations that make your applications much more powerful and easier to use without additional work from you.
If you have an existing self-managed version of MongoDB running on-premise that you want to move to AWS, you must weigh the benefits of running it in the same familiar way on AWS against making whatever changes in coding and operations may be required to use MongoDB Atlas.
The issue with such a lift-and-shift approach is that you may be replicating the complexity of your on-premise deployment in the cloud. It’s worth weighing this against the benefits of a live migration
If your team is already a master of MongoDB self-managed on AWS, then the costs and time taken to switch to MongoDB Atlas should be weighed against the savings in time achieved (and capabilities gained) by using MongoDB Atlas.
All of this said, the really important thing is to know what you want to do now and in the future. The more precise that picture is, the easier it will be to make the right choice.