DevOps

How to Migrate MongoDB from One Cloud to Another (Complete Guide)

MongoDBMigrationCloudDatabaseWindowsLinuxmacOS

How to Migrate MongoDB from One Cloud to Another (Complete Guide)

Migrating MongoDB from one cloud to another is a common task when:

  • Moving to a new hosting provider
  • Creating backup before major updates
  • Cloning production to staging
  • Changing MongoDB Atlas account
  • Migrating client infrastructure

This guide explains the safest professional method to migrate MongoDB between cloud providers.

Supported systems:

  • Windows
  • Linux
  • macOS

Tools used:

  • mongodump (export database)
  • mongorestore (import database)

Migration Architecture

Old MongoDB Cloud → Backup → Local System → Restore → New MongoDB Cloud

Steps:

  1. Export database from old cloud
  2. Save backup locally
  3. Restore to new cloud
  4. Verify data

Requirements

Old MongoDB URI

mongodb+srv://username:password@oldcluster.mongodb.net/olddb

New MongoDB URI

mongodb+srv://username:password@newcluster.mongodb.net/newdb

Install MongoDB Database Tools

https://www.mongodb.com/try/download/database-tools


Windows Migration

Step 1 — Dump Database

Open CMD and run:

mongodump --uri="OLD_URI" --out="C:\backup"

Step 2 — Restore Database

mongorestore --uri="NEW_URI" "C:\backup\olddb"


Linux Migration

Install tools

sudo apt update sudo apt install mongodb-database-tools -y

Dump

mongodump --uri="OLD_URI" --out=/home/backup

Restore

mongorestore --uri="NEW_URI" /home/backup/olddb


macOS Migration

Install tools

brew tap mongodb/brew brew install mongodb-database-tools

Dump

mongodump --uri="OLD_URI" --out=~/backup

Restore

mongorestore --uri="NEW_URI" ~/backup/olddb


Backup First (Important)

mongodump --uri="OLD_URI" --out=backup

Keep backup safe before migration.


Copy One DB to Another Name

mongodump --uri="mongodb+srv://old/test" --out=dump mongorestore --uri="mongodb+srv://new/production" dump/test


Production Tips

✔ Always take backup
✔ Stop writes during migration
✔ Verify collections
✔ Test on staging
✔ Check data after migration


Verify After Migration

show dbs
use dbname
show collections


Author

Marquefactory DevOps Team

Need help applying this?

Discuss your software idea, product roadmap, or internal system

If this article connects to a product idea, workflow problem, MVP plan, or custom platform requirement, we can help you turn it into a scoped delivery plan. MarqueFactory works with founders and businesses that need senior technical judgment, not just implementation tickets.

  • MVP planning and custom SaaS development
  • Web apps, mobile apps, and internal systems
  • Architecture, delivery roadmap, and build estimates
  • Senior-led product and engineering guidance

Related Services

If this topic connects to a real build, these are the pages most likely to help you evaluate fit, scope, and delivery approach.

Useful Tools

These free tools are useful on their own, and they also reflect the kinds of systems we help businesses turn into custom platforms.

Related Articles