How should I use EC2 ? One instance per application or one for all the architecture

amazon ec2amazon-web-services

I have a kind a complex architecture involving 5 differents applications:

  • 1 API
  • 1 Frontboard
  • 1 Dashboard
  • 1 Administration Panel
  • 1 Public File hosting app

All these apps are actually hosted on a single dedicated server and running in Node.js

I want to push my architecture in the Amazon AWS cloud but I'm still questioning myself about the new architecture I want to set-up.

Do I need to split my apps and run one EC2 instance for each app (and possibly 1 load balancer for each application group) or can I run all my apps in one single instance and use a single load balancer on top of it.

I wish I could be more precise, but I'm not used to scaling techniques.

Hugo.

Best Answer

Assuming you're not concerned with high availability, If one instance can handle the load, then put them all on one instance. That said, I would put some monitoring around those particular services so that you know when its time for them to have their own host(s). You might find that different services are going to need to scale out at different rates. The only good way to keep an eye on that is with good monitoring and instrumentation.

You can save yourself a lot of headache later by introducing some abstraction between services. For example, make sure that when one service is calling the API, it calls it by some name (DNS is great for this). Something like api.myapp.com will be fine. Maybe initially, all the names point to the same host. But in the future, when you need to scale, you can point that name to an Elastic Load Balancer with a bunch of instances behind it, and nothing in your application needs to change to talk to the new instances.

If you are concerned with high availability, you need more than one box. full stop.