mongoDB atlas scaling with AWS regions

0

I have 6 EC2 Instances on different region on AWS. I have only one MongoDB server on MongoDB Atlas (AWS). I am having latency issue while updating Data to the database. what is the best way to scale my MongoDB server with My 6 EC2 instances.

asked 5 years ago558 views
2 Answers
0

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.

answered 5 years ago
0

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.

answered 2 years ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions