MongoDB Atlas Connection Over VPC

Hi Team,

Is it best practice to connect to a MongoDB atlas cluster via VPC peering? Would this remove our need for static IPs to connect to MongoDB?

Hey @itajenglish ,

VPC Peering is definitely a better practice and cheaper (it’s free on AWS) than using a pool of static IPs. Check out our guide on how to set up VPC peering :point_down:

1 Like

Does this mean I have to recreate all my clusters to turn off static IP’s? Do I also need to pick a custom subnet in order to use VPC peering?

Yes, you need to migrate your current workload to a new cluster without static IPs. But no worries, it’s quite easy. (Still, you need to plan this migration because your service will not be available until it’s up on the other cluster, and your database and domain have been migrated).

Cluster Migration Process

Here is the migration process to follow:

  1. Create a new cluster on AWS (no need to pick a custom subnet)
  2. Launch the installation of your new cluster and wait until it is ready.
  3. Clone your production environment into your new cluster and give a name like new-production.
  4. Create a new custom domain for the app of your new environment
  5. Make your old and new databases publicly accessible (you’ll need to redeploy them to apply the changes).
  6. Start your new environment on your new cluster.
  7. Use Replibyte or any migration tool to copy your production data to your new production data. (Or you can use your AWS console as well)

I’ve recorded this video to make it clear. Let me know :slight_smile:

1 Like

Awesome thanks @rophilogene super helpful!

1 Like