Creating automated snapshots at AWS for a MySQL partition (Slave DB Server)
- Create a snapshot from the Mysql Slave server
- Only if the replication lag is 0; else wait until the slave gets up-to-date with the master
- You'll need a MySQL Standby DB Server running
- You'll need a root access to that MYSQL Instance
- The script is run locally on the slave server
- Assuming the slave server is hosted in AWS, you'll need to create an IAM role with full EC2 access.
- You'll need to create a topic and a subscription in SNS. So if the snapshot fails you'll get an email alert.
- The script assumes that you are running your MySQL DB in the
- Change all the CHANGEME to your settings/values.
- You'll need the
AWSCLI toolinstalled on your instance.
- Adding permission to the files:
chmod +x mysql-create-snapshot.*
- From the root directory, run:
- mkdir -p