I have an Amazon EC2 server where we run a webapp and MongoDB. We want add a second EC2 server and a Load Balancing to the same region. Load Balancing will redirect all web requests (80 and 443) to the EC2 servers.

Can someone give me some general advises on how to setup MongoDB?



2 Answers 2


You probably dont want to use an ELB. Mongo has its own router that understands mongo's sharding. Here is a starting point:


  • Sorry I didn't provide enough information on my post. I am going to edit it.
    – Marco C
    Oct 3, 2013 at 1:08

Set up MongoDB on its own EC2 instance separate from the web-facing ones that are behind the ELB. This way, going forward you can increase the capacity of either resource without impacting the performance of your webapp. MongoDB understands sharding and can scale quite well, and the ELB on the web-side will help with that.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .