Skip to content
Explainer · MongoDB in the cloud

MongoDB Hosting: Atlas vs Self-Hosted vs Alternatives

The four realistic ways to host MongoDB in the cloud: MongoDB Atlas on AWS, Azure or Google Cloud, MongoDB Community Edition on your own VM, and the MongoDB-compatible services from AWS and Microsoft, with the compatibility caveats each vendor documents.

Facts checked 8 October 2026 against the providers' official documentation and pricing pages. Next review due January 2027. Cloud services, regions and prices change often; confirm on the provider's site before you buy.
Short answer
  • 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.
How we know: Research-based: tiers, prices, licences and compatibility statements were checked against mongodb.com (pricing page, Atlas documentation, licensing pages), the Amazon DocumentDB developer guide and pricing page, and Microsoft Learn on 8 October 2026. We have not deployed clusters on any of these services for this guide, so no performance claims are made.

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.

MongoDB hosting options compared (as documented, October 2026)
OptionWho runs itEngineCloudsMain caveat
MongoDB AtlasMongoDB, fully managedMongoDBAWS, Azure, Google CloudCosts rise with tier, storage, backups and data transfer
Self-hosted Community EditionYou, on VMs or containersMongoDBAnyYou own backups, upgrades, security and high availability
Amazon DocumentDBAWS, fully managedAWS engine, MongoDB-compatibleAWS onlyDocumented functional differences from MongoDB
Azure Cosmos DB for MongoDB (RU)Microsoft, fully managedCosmos DB, MongoDB wire protocolAzure onlyFeature support depends on the API version
Azure DocumentDB (with MongoDB compatibility)Microsoft, fully managedOpen-source DocumentDB, MongoDB-compatibleAzureMicrosoft 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.

Starting prices, checked 8 October 2026
OptionStarting priceWhat it includes
Atlas Free0 USD512 MB storage, shared RAM and vCPU, one per project
Atlas Flex0.011 USD per hour base, up to 30 USD per monthUp to 5 GB storage, 100 ops/sec in the base price
Atlas Dedicated M100.08 USD per hour (starts at 56.94 USD per month)10 GB storage, 2 GB RAM, 2 vCPUs
Amazon DocumentDB db.r5.large0.277 USD per hour (AWS example)Instance only; storage 0.10 USD per GB-month and I/O billed separately
Self-hosted Community EditionNo licence feeYou 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

Checked 8 October 2026.

How we research cloud database guides: our editorial method. CodeWithSQL earns nothing from the providers mentioned.

Choosing where to run your database?

Start with the section overview, or compare providers side by side.