- MongoDB Atlas is MongoDB's own managed service and runs on AWS, Azure and Google Cloud; it has a Free tier, a Flex tier capped at 30 USD a month, and Dedicated clusters billed hourly.
- Self-hosting MongoDB Community Edition on a VM costs only the infrastructure, but you run backups, upgrades and replica sets yourself; the server is licensed under the SSPL.
- Amazon DocumentDB and Azure Cosmos DB for MongoDB are not MongoDB: they implement the MongoDB wire protocol, and each vendor documents functional differences to check before migrating.
- Choose Atlas for the full MongoDB feature set with the least operational work; choose a cloud provider's compatible service mainly when staying inside one provider's ecosystem matters more than full compatibility.
MongoDB cloud hosting options
MongoDB cloud hosting comes down to who runs the database and whether it is MongoDB itself. MongoDB Atlas is the vendor's managed service. Self-hosting means installing MongoDB Community Edition (or Enterprise Advanced, under a subscription) on a VM or in containers. Amazon DocumentDB and Azure Cosmos DB for MongoDB are managed databases that speak the MongoDB protocol but run their own engines. The table compares them.
| Option | Who runs it | Engine | Clouds | Main caveat |
|---|---|---|---|---|
| MongoDB Atlas | MongoDB, fully managed | MongoDB | AWS, Azure, Google Cloud | Costs rise with tier, storage, backups and data transfer |
| Self-hosted Community Edition | You, on VMs or containers | MongoDB | Any | You own backups, upgrades, security and high availability |
| Amazon DocumentDB | AWS, fully managed | AWS engine, MongoDB-compatible | AWS only | Documented functional differences from MongoDB |
| Azure Cosmos DB for MongoDB (RU) | Microsoft, fully managed | Cosmos DB, MongoDB wire protocol | Azure only | Feature support depends on the API version |
| Azure DocumentDB (with MongoDB compatibility) | Microsoft, fully managed | Open-source DocumentDB, MongoDB-compatible | Azure | Microsoft states 99.03% MongoDB compatibility |
MongoDB Atlas: the managed MongoDB cloud
Atlas is the most direct way to run MongoDB in the cloud. MongoDB says it supports multi-region and multi-cloud deployments in more than 125 regions across AWS, Azure and Google Cloud, so "MongoDB on AWS", "Azure MongoDB" and "GCP MongoDB" usually mean Atlas deployed in that provider's region and billed by MongoDB. Atlas now has two deployment options: Atlas Core with Free, Flex and Dedicated tiers, and Atlas Infinite, a public-preview option for M10 and larger clusters with compute and storage scaled separately.
The tiers matter for hosting decisions. Free clusters (formerly M0) are limited to 512 MB, one per project, with no backups. Flex replaced the old M2, M5 and Serverless options: MongoDB stopped creating those in February 2025 and migrated the remaining clusters by 22 January 2026. Dedicated clusters (M10 upwards) are the tier MongoDB positions for production applications, with configurable storage and Cloud Backups billed per GB. Full prices and worked examples are in our sibling guide on Atlas pricing (see related pages below).
Self-hosting MongoDB on a VM
MongoDB documents official Community Edition builds for Linux, Windows and macOS, and an official Docker image, so you can run it on any cloud VM or Kubernetes cluster. You pay only the provider's compute, storage and network charges, and you keep full control of versions and configuration. In exchange you deploy and patch replica sets, configure authentication and TLS, schedule backups and handle failover yourself.
Check the licence before you host for others. MongoDB Community Server releases after 16 October 2018 use the Server Side Public License (SSPL). MongoDB's FAQ says section 13 of the SSPL, which sets conditions for offering the software as a service to third parties, does not apply when you run MongoDB as a service internally or for subsidiary companies. MongoDB describes Community Edition as the free, source-available version; Enterprise Advanced adds features such as auditing, Kerberos authentication and an in-memory storage engine.
AWS MongoDB alternative: Amazon DocumentDB
Amazon DocumentDB (with MongoDB compatibility) is a fully managed AWS service that lets you use the same drivers and tools you use with MongoDB. AWS states that DocumentDB 8.0 has full wire protocol compatibility with MongoDB 8.0 and also supports applications built with MongoDB API versions 6.0 and 7.0. It is not the MongoDB server, and AWS keeps a page of functional differences.
Examples from that page: retryable writes, which most current MongoDB drivers enable by default, are supported only from engine version 8.0.2, so on older engines you must disable them; $vectorSearch is not supported as an independent operator, only inside $search. Pricing follows the Aurora-style model of instances plus storage and I/O, with an I/O-Optimized option and a serverless option. For the document-database trade-offs in general, see DynamoDB vs MongoDB.
Azure MongoDB options: Cosmos DB and Azure DocumentDB
Microsoft offers two MongoDB-compatible services. Azure Cosmos DB for MongoDB is a fully managed NoSQL service that supports the MongoDB wire protocol, with automatic sharding, global distribution and five consistency levels; Microsoft states that it does not run MongoDB databases to provide this service and is not affiliated with MongoDB, Inc. Supported commands and operators depend on the server version you select, so check Microsoft's feature-support tables.
Azure DocumentDB (with MongoDB compatibility), documented alongside Cosmos DB on Microsoft Learn, is built on DocumentDB, an MIT-licensed, Linux Foundation-governed open-source engine. Microsoft states 99.03% MongoDB compatibility and that MongoDB's SSPL does not apply because it does not run the MongoDB server or its codebase. For Cosmos DB in general, see our guide in the related pages below.
Which MongoDB hosting option to choose
- Learning or a prototype: an Atlas Free cluster, or a Flex cluster if you need more than 512 MB or backups.
- Production on MongoDB itself: Atlas Dedicated, in the cloud and region closest to your application.
- Strict cost control and in-house operations skills: Community Edition on VMs, accepting the operational work.
- All-in on AWS or Azure: DocumentDB, Cosmos DB for MongoDB or Azure DocumentDB, after checking your queries and drivers against the vendor's compatibility list.
If you are still deciding whether a document database fits, see MongoDB vs PostgreSQL and relational vs document databases. For desktop tools to manage any of these, see the best MongoDB GUI tools.
Pricing
Prices from the provider's official pricing pages, checked 8 October 2026, region Atlas: AWS tab of the MongoDB pricing page; DocumentDB: US East (N. Virginia) as used in AWS's examples, in USD, excluding tax. List prices only; discounts, commitments and your actual usage change the bill.
Starting prices below are the headline list prices. Atlas Dedicated prices vary by cloud provider, region and storage; Azure Cosmos DB and Azure DocumentDB prices are not quoted here because they depend on the throughput model and region you select on Microsoft's pricing pages.
| Option | Starting price | What it includes |
|---|---|---|
| Atlas Free | 0 USD | 512 MB storage, shared RAM and vCPU, one per project |
| Atlas Flex | 0.011 USD per hour base, up to 30 USD per month | Up to 5 GB storage, 100 ops/sec in the base price |
| Atlas Dedicated M10 | 0.08 USD per hour (starts at 56.94 USD per month) | 10 GB storage, 2 GB RAM, 2 vCPUs |
| Amazon DocumentDB db.r5.large | 0.277 USD per hour (AWS example) | Instance only; storage 0.10 USD per GB-month and I/O billed separately |
| Self-hosted Community Edition | No licence fee | You pay for VMs, disks, backups and network |
Frequently asked questions
Is MongoDB Atlas available on AWS, Azure and Google Cloud?
Yes. Atlas deploys clusters on all three providers, and MongoDB says it supports more than 125 regions across them, including multi-cloud clusters. You are billed by MongoDB rather than by the cloud provider.
Is Amazon DocumentDB the same as MongoDB?
No. DocumentDB is an AWS database that is compatible with the MongoDB wire protocol and drivers. AWS documents functional differences, for example retryable writes are supported only from engine version 8.0.2, so test your application before migrating.
Is there a free MongoDB hosting option?
Yes. Atlas Free clusters cost nothing, with 512 MB of storage and one cluster per project, but no backups. Self-hosting Community Edition has no licence fee, but you pay for the server.
Can I host MongoDB myself and sell it as a service?
MongoDB Community Server is under the SSPL, whose section 13 sets conditions for offering the software as a service to third parties. MongoDB's FAQ says internal use, including for subsidiary companies, does not trigger it. Take legal advice for anything else.
What happened to Atlas Serverless and M2/M5?
MongoDB replaced them with Flex clusters. New M2, M5 and Serverless instances could not be created from February 2025, and from 22 January 2026 Atlas no longer supports them; existing ones were migrated.
Sources
- MongoDB pricing
- MongoDB Atlas database
- MongoDB Atlas docs: Free cluster limits
- MongoDB Atlas docs: Flex cluster costs
- MongoDB Atlas docs: Cluster configuration costs
- MongoDB docs: Install Community Edition
- MongoDB licensing
- MongoDB SSPL FAQ
- MongoDB Community Edition
- Amazon DocumentDB: What is DocumentDB
- Amazon DocumentDB: MongoDB compatibility
- Amazon DocumentDB: Functional differences
- Amazon DocumentDB pricing
- Microsoft Learn: Azure Cosmos DB for MongoDB
- Microsoft Learn: What is Azure DocumentDB
Checked 8 October 2026.
How we research cloud database guides: our editorial method. CodeWithSQL earns nothing from the providers mentioned.