2

I'm working on a project where we will be using ECS to run the API of each client, it will start with one but it will eventually grow. We will also need a database for each client and the Project Manager decided that we should have an instance of both API and MySQL for each client. It would be a lot more simple if we used multiple databases inside a MySQL instance but that is not the case.

I've looked at RDS and we can't really have multiple instances of a MySQL database inside an on-demand instance, which makes which leads to a single on-demand instance for each client. On the other hand, running each MySQL instance on a container (while integrating with EFS) in ECS does not feel safe and perhaps troublesome to run backups.

What would you advise me to do in this scenario? Thanks!

  • Project managers making technical decisions doesn't always work out well. You should explain the cost implications of this to him of having many instances. RDS reduces administration and increases reliability, though it is more expensive than running MySQL yourself. I run MySQL, Nginx, PHP on a t2.nano, it works fine for a lightly loaded system and costs basically nothing, but the smallest RDS instance is (from memory) $10 per month. – Tim Apr 17 '19 at 09:10
  • The clients will be the ones paying for the expenses though, @Tim. I've already explained that to him and that's exactly why we thought about the ECS + EFS to run MySQL with persistent data, I'm just not sure if that's any good of an approach. – Tomás Fonseca Apr 17 '19 at 09:18
  • My understanding is containers are generally ephemeral, so you can lose them any time, so the idea to use EFS sounds ok... the problem is EFS is fairly low performance which could handicap your applications. If you can do persistent containers and use EBS you'd be ok, but I'd keep very regular backups or exports to S3. – Tim Apr 17 '19 at 20:06

1 Answers1

3

Choose the right service for the job.

RDS

  • Managed service
  • Automatic fail-over
  • Automatic backup, easy restore
  • Automatic disk space management (in case of Aurora)
  • Detailed performance stats in CloudWatch
  • Little more expensive, however you get a lot more for the money

MySQL on EC2

  • Cheaper than RDS
  • You have full control of the setup (do you really need it?)
  • All management is up on you - backup, restore, fail over, etc.

MySQL in an ECS container

  • Pros ... ehm ... none?
  • Cons - containers are not meant to store stateful data. That workaround with EFS is just that - a workaround.

The bottom line is to convince your project manager that RDS is the best suited service for storing data. If his worry is the appropriation of the RDS costs to your customers you can charge them some flat fee for "database service" and that with N customers will cover the cost of RDS and with >N customers will contribute to your profit.

Hope that helps :)

MLu
  • 23,798
  • 5
  • 54
  • 81