I have a pretty simple node app with a mongo database and was wondering the best way to deploy it using AWS.
I had been trying to put the frontend and mongo on two separate task definitions and deploying them to the same cluster (with the frontend behind an ELB), but I am struggling to connect the containers since you can't just link the containers if they are in separate task definitions.
It is a pretty simple HTML5 game, so it is making updates to the database very frequently but the updates are basically just point changes. This game would probably be fine on just a small single instance for the node app and another instance for mongo, but I am hoping to learn "best practices" (or, more likely, decent practices) for larger future projects.
Some other ways I was thinking of deploying (always putting the frontend behind an ELB and autoscaling both the mongo and frontend):
- Dockerize the node app and then just launch the mongo portion as a non-containerized EC2 instance
- Concerned about scaling -> If I need another instance how do I connect my frontend to both instances and persist data between them (ELB?)?
- Concerned about scaling -> If I need another instance how do I connect my frontend to both instances and persist data between them (ELB?)?
- Dockerize both node app and mongo and put in same cluster
- If I put them in the same Task Definition, then I believe they both have to scale together which seems weird
- I tried putting them in separate Task Definitions and then in the same cluster but I cannot connect my frontend container to my mongo container - you can't link containers in separate task definitions and I have tried every URL/IP I can find to connect them and it isn't working (I have a question discussing this issue here)
- Could I / should I put mongo behind an ELB as well and connect my node app using the ELB DNS?
- Could I / should I put mongo behind an ELB as well and connect my node app using the ELB DNS?
- Dockerize both node app and mongo and put them in separate clusters
- Haven't tried this yet but assume I would run into the same issue of trying to connect the containers
Thank you for the help!