I have been working in with MongoDB Atlas Cloud, and involved with few configurations, I thought to bring up this article to show how to create a VPC Peering in MongoDB Atlas and AWS cloud. If you are new for MongoDB Atlas Cloud please feel free to go through my previous post.
To work with MongoDB VPC peering MongoDB Atlas cluster should be built with M10 or higher Tier. Still You can create the VPC Peering with the Free Tier Sandbox and the VPC peering functionality would not succeeded with that. MongoDB Atlas M10 Tier will give you 2GB of RAM and 10GB of Storage, along with 100 IOPS and 350 Maximum connections up to 5 Gigabit Network Performance.

Creating cluster would take few minutes, and allow sometime to complete the creation process. After the completion of the cluster creation, go to the “Network Access“.

Click on “Peering” and “+NEW PEERING CONNECTION” button to create the peering connection

Select the cloud provider, I’m not quite sure of the purpose of this step as other cloud providers grayed out. Also, I’m not quite sure whether MongoDB Atlas can make cross cloud platform peering for the connectivity. Go to the next step.

Provide the Approver VPC details in the next step, including, AWS account ID, VPC ID, CIDR Block, Regions and MongoDB Atlas CIDR.

It will initialize the VPC Peering connection to the AWS account, and its time to approve the VPC Peering request from the AWS VPC.
VPC Peering request will appear in the AWS VPC, and it will be awaiting for the approval

Approve the Peering request


AWS VPC CIDR will show as “Active” after the successful VPC Peering connection

VPC Connection shows as “Available”, for me it took a while to reflect it here even though connection established

Edit the AWS Route table to route MongoDB CIDR block traffic through the peering connection

I had few connectivity issues, and I had to enable the “DNS resolution from requester VPC to private IP” option in order to fix them.

I have installed the “MongoShell” on my EC2 instance and copied the connection url from the MongoDB Atlas console. If you want to know how to install the Mongo shell follow my previous article.

I was able to connect to the MongoDB Cluster without an issue from my EC2 instance

Verified the connectivity to the local IP through the VPC Peering Connection

Create A VPC Peering In MongoDB Atlas Cloud to AWS was quite easy and it is the way to access the MongoDB Atlas Cloud from EC2 instances securely and efficiently in the cloud.