I have a template EC2 instance that runs a web server as well as the MySQL db. The instance is atomic, in the sense, everything needed is inside the instance itself. Generally, I just image a blank server, and deploy. I am able to deploy multiple instances rapidly.

I didn't think my service would grow....and I am at 15 instances. However, now that I am adding improvements, I am having to add db tables, and other small changes. All that is fine, as the number is 15... but what about when it is 50 or 100? It is getting difficult to scale this, as I have to ssh in, and manually update each database in all the servers.

Are there any tools to help with this? How can I deploy/update my changes to database structures across multiple instances/servers, without losing any data? Or do I have to make a custom script/process?

I am running Ubuntu 18, with mysql 5.7 on the servers, if that helps.

  • 1
    Consider a framework of ansible/chef/puppet, some of might have existing module. But if not, writing an ansible one shouldn't too hard. Unfortunately its not until MySQL 8 that all the nice ALTER TABLE ... if / if not exists syntax appears (or MariaDB). If they all had the same data, maybe a replication scenario just for the purpose of alterations would help. – danblack Sep 2 '20 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.