I have followed this guide to configure VPC peering between Mongo Atlas and Qovery. I have also updated my cluster so that it can pick up the changes I have made to my route table (as per the documentation)
I have also added an ingress SG rule to allow traffic on port 27017 in my cluster.
The problem is I still can’t connect to Mongo
const serverSelectionError = new ServerSelectionError();
MongooseServerSelectionError: Server selection timed out after 30000 ms
at NativeConnection.Connection.openUri (/app/node_modules/mongoose/li
Ok it seems that you have made everything that was required. However, I know that DNS resolution across VPC peering is a common issue. Can you check that you have turned on this feature within your VPC? Here is the procedure:
To enable DNS resolution for a peering connection
- Open the Amazon VPC console at https://console.aws.amazon.com/vpc
- In the navigation pane, choose Peering Connections.
- Select the VPC peering connection, and choose Actions, Edit DNS Settings.
- To ensure that queries from the peer VPC resolve to private IP addresses in your local VPC, choose the option to enable DNS resolution for queries from the peer VPC. This option is Requester DNS resolution or Accepter DNS resolution, depending on whether the VPC is the requester or accepter VPC.
- If the peer VPC is in the same AWS account, you can enable DNS resolution for both VPCs in the peering connection.
- Choose Save.
- If the peer VPC is in a different AWS account or a different Region, the owner of the peer VPC must sign into the VPC console, perform steps 2 through 4, and choose Save.
Those instructions come from the AWS documentation
I have done this now.
FYI - this is peereing between Mongo DB Atlas VPC (i have no control of this) and my VPC.
Perfect, can you give a shot (to connect to your MongoDB Atlas instance) now from your application?
i have tried and it still not working
Are you sure you are using the right MongoDB host address?
Hi @itajenglish, @dugwa try to set up his MongoDB Atlas connection via VPC peering. No success so far. I know you did succeed in managing the connection to MongoDB Atlas via VPC peering recently. Can you explain how you make it works? And how did you get an internal host for your MongoDB connection string? Thank you
@rophilogene Happy to help! Hi @dugwa did you edit the routes table in AWS or in the Qovery console?
@itajenglish - yes I did that
Do you mind joining our Google Meets call ?
I am currently brainstorming with @rophilogene
Thank you @itajenglish for your help. We’ll try to create a new cluster tomorrow and see if it helps. Cc @Pierre_Mavro
Finally solved the mystery.
The Atlas DB was deployed in a separate region from my App.
So when initiating the VPC request from Atlas, you need to take that into consideration and ensure that you corrrectly specify the region where Atlas lives and also the region where your app lives.
Wow… I didn’t expect that. Thanks for sharing the answer. I will write a guide and include it.