A tool to help automate EBS snapshots for EC2 instances across your AWS accounts. Based on settings in config.yaml, it will snapshot EBS volumes on hosts based on their 'Tag:Name'. With the use of 'retention' period, it can curate/remove old snapshots if they have reached their experation period ( as defined in config.yaml, per host ).
make_snapshots()
- Creates snapshots across each instance defined in config.yamllist_snapshots()
- Lists all the snapshots associated with EBS volumes with instances defined in config.yamlcurate_snapshots()
- Deletes all EBS snapshots associated with instances in config.yaml that are older than the 'retention' period.ebsnap()
- runs bothmake_snapshots
andcurate_snapshots()
- Git clone this repo to a directory of your choice
- Using config.yaml.example, create a config.yaml and pouplate it with your relevant AWS info and instances you wish to run EBS snapshots on
- create the virtualenv
virtualenv env && source env/bin/activate && pip install -r requirements.txt
- run it
fab ebsnap
Protip: Set this up on a cron job so it can run every day at midnight or time of your choosing.
* 0 * * * cd /opt/tools/EBSnap; env/bin/fab ebsnap
- python 2.7
- virutalenv
- pip
- proper AWS IAM account with grants required for EC2 and EBS