Migrate a MongoDB Replica Set from AWS to MongoDB Atlas

Deployment Type:

Author: MongoDB Documentation Team

The MongoDB Atlas Live Migration Service helps you migrate MongoDB databases to our fully managed cloud database, MongoDB Atlas, quickly and securely. It works by connecting to your existing MongoDB database and synchronizing it with a cluster running in Atlas all while your application continues to function normally. Once the data between the two clusters has been synchronized, you can simply update the database connection string in your application to cut over to your cluster in Atlas.

Time required: 20 minutes

What You’ll Need


Your data is currently in a MongoDB database.

This guide focuses on migrating to Atlas from an existing MongoDB deployment on AWS. If you have data in other database systems, such as MySQL, PostgreSQL, or DynamoDB, please contact us for help with your migration.


Your current MongoDB database is running MongoDB 2.6+

Atlas supports the latest versions of MongoDB: 3.4, 3.6, and 4.0. If you’re running MongoDB version 2.6 or greater, the Atlas Live Migration Service can move your data directly into a newer database version. Update your MongoDB drivers and make any necessary code changes at the application level to ensure compatibility. If you’re running a version older than 2.6, see Upgrade MongoDB to 2.6 for upgrade instructions.


Your current deployment is a MongoDB replica set.

If your deployment is currently a standalone instance, you must first convert it to a replica set. Live migration of data from sharded clusters is not supported.


Authentication is enabled on your source deployment

The migration process requires that authentication is enabled on your source cluster in AWS. See Enable Auth for instructions on enabling authentication.

You can verify that authentication is enabled on your source cluster using the mongo command:

mongo <mongodb-connection-string> -u <mongodb-username> -p --authenticationDatabase admin

The database user from your source cluster on AWS that you will use to perform the migration has the required MongoDB roles.

The user must have the clusterMonitor and backup roles. To verify that the database user that you intend to use for migration has the appropriate roles, run the db.getUser() command.

testRS:PRIMARY> use admin
switched to db admin
testRS:PRIMARY> db.getUser("admin")
  "_id" : "admin.admin",
  "user" : "admin",
  "db" : "admin",
  "roles" : [
      "role" : "backup",
      "db" : "admin"
      "role" : "clusterMonitor",
      "db" : "admin"



Launch your target replica set in MongoDB Atlas.

See Create an Atlas Account and Cluster for instructions.


Your target cluster must use M10 or larger instance nodes. For development or staging environments, deploy a cluster with M10 or M20 instance nodes. For production workloads, select M30 or larger instance nodes.


Open Atlas Live Migration Service.

On the Overview page of your new target cluster, click the ellipsis (…) button and select Migrate Data to this Cluster.


Click I’m ready to migrate.


Whitelist the Atlas Live Migration Service on your AWS source cluster.

At the top of the Migrate Data to Cluster modal, Atlas displays the IP address ranges that must be accessible from your source cluster. The address ranges displayed depend on the location of your target cluster and can change, so verify that you enter the address ranges as displayed in the modal.

AWS EC2 servers are protected from unauthorized network access using Security Groups. To whitelist new IP address ranges, either create a new Security Group, or modify your existing Security Group to permit inbound network access from the displayed IP address ranges.

Here is an example security group that grants access to Atlas Live Migration Service.


If you create a new Security Group, you must associate it with the EC2 instances running your source cluster. In the AWS EC2 console, click the Actions dropdown and select Change Security Group.


For additional information on creating or modifying Security Groups, see Adding Rules to a Security Group in the AWS EC2 documentation.


Validate your AWS credentials with Atlas Live Migration Service.

  1. On the Migrate Data to Cluster modal, enter the hostname and port number of the primary node in your source AWS source cluster that Atlas will use to perform the data migration.


    The address must be resolvable over the public internet, so do not use the private IP address of the node.

  2. Enter the MongoDB username and password from the AWS source cluster in Username/Password.

  3. If SSL is enabled on the source cluster, toggle the Is SSL enabled to Yes and upload the CA file that your source AWS cluster uses.

  4. Click Validate.


Click Start Migration.

A countdown timer in a progress bar indicates how much time remains before your target cluster is ready to migrate data from your source cluster. Wait until the countdown timer and the Start Cutover button are green before proceeding to the next step.


Click Start Cutover.

Your AWS cluster and your Atlas cluster are now in sync. Atlas will maintain this synchronized state for 72 hours. If you need more time, syncing can be extended for another 24 hours.


You created an Atlas cluster, migrated data from your old AWS MongoDB cluster, and updated your applications to use the new MongoDB Atlas cluster. For more information on the data migration process, see Live Migrate Your Replica Set to Atlas and mongomirror.

What’s Next