- Newest
- Most votes
- Most comments
You can try one way you can apply the VPC peering from EC2 to MongoDB Atlas (AWS). As MongoDB Atlas as now VPC peering function.
If you are trying to connect the MongoDB using public-facing network, then it might be slow.
AWS launched instances in a different region may create a connection using inter-region cross VPC peering.
So if you are following tradition way to whitelisting ACL's better try this it will reduce latency issue.please peer all the region's VPC (make sure there will not be any IP conflict) and try to connect using private connections.
EDIT : 1
There is no additional penalty with MongoDB in terms of using it out of region, but most database protocols are not optimized for high latency conditions. You might be much better off setting up a read replica in other regions.
You can read this: https://www.mongodb.com/blog/post/optimizing-fast-responsive-reads-cross-region-replication-mongodb-atlas
EDIT : 2
If you can't push your database to multiple regions (by using read replicas for example), then you should consider using CloudFront in front of your application(website) to allow for caching of requests in the different regions.
It won't technically improve the latency between application and database, but in terms of your user's perception of performance, it will be little speedy.
Here's a secure and cost-effective way you can connect to your MongoDB cluster using AWS IAM passwordless authentication. I think it is one of the fastest ways to connect to the DB as well.
Link: https://vishnusblog.tech/secure-mongodb-with-aws-iam-passwordless-authentication-example
You could create a global EC2 role and assign it to all of your instances. Use that role to enable authentication with reference to the article mentioned.
Relevant content
- asked 2 years ago
- asked a year ago
- asked 3 years ago
- asked 9 months ago
- AWS OFFICIALUpdated a year ago
- AWS OFFICIALUpdated 2 months ago