How To: Dockerized MongoDB Replication on Elastic Container Service
Solution 1:
Don't dockerize databases. Docker containers are meant to be ephemeral and not hold data. That's not appropriate for databases.
In particular, do not attempt to dockerize a MongoDB cluster. The setup for replica sets is extremely stateful and complex. You have to run many commands in order and only once. If you miss any command or if a node goes off, the entire cluster might dead lock and you'll be forced to start over.
Docker has its own idea of how applications should behave. It would be really difficult to make that work inside Docker.
If you want a cluster with 3 replicas, you should get 3 AWS instances and setup MongoDB on the instances. Search for mongodb setting up a replica set on <OS>
on Google, that will give you an up to date tutorial.
Solution 2:
FireCamp does it. FireCamp could deploy a MongoDB ReplicaSet on AWS ECS very easily. 1) deploy the ECS cluster with cloudformation template, 2) deploy the MongoDB ReplicaSet by a single command. Check FireCamp Installation wiki for the details.
For security, it is better to run the Node.js app in another ECS cluster. The EC2 instances that run MongoDB should not be exposed to the external world.
The Elastic Load Balancer is not required for the Node.js app to access MongoDB ReplicaSet. Every replica gets a unique dns name. Node.js app could simply access MongoDB by the dns name.