Migrate a MongoDB Replica Set from AWS to MongoDB Atlas¶
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 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.
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:
The database user from your source cluster on AWS that you will use to perform the migration has the required MongoDB roles.¶
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
M20 instance nodes. For production workloads,
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.¶
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.
Enter the MongoDB username and password from the AWS source cluster in Username/Password.
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.
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.