When building an application/system that is to be run in the cloud (e.g., AWS),
is it recommended to always make single-purpose instances?
For example, should I have two instances running MySQL (master+slave), and then two web-server instances, instead of combining web+MySQL in one (possible larger) instance?
Whats the pros and cons, except separation of concerns?
The primary reasons why it’s better to have single-purposes instances are:
1) It’s easier scale. (eg: just scale up the bottlenecks rather than having to scale the entire stack)
2) It’s more secure (eg: your MySQL database isn’t on a server that has port 80 open because it also needs to accept your http traffic)
The only good reason not to have single-purpose instances is price. It costs money and for some people it’s too much.
If you’re doing any kind of e-commerce then definitely use single-purpose instances since most security standards (like PCI-DSS for example) require it. If you’re running a content site that doesn’t have any e-commerce components and doesn’t accept sensitive data from your users, then you can probably be a little looser to save a few bucks, but I don’t recommend it.