aws-autosnap is a python script to make it easy to automatically snapshot any EBS volumes.
Simply add a tag to each instance/volume you want to snapshots regularly, configure and run this container and you're done. It will even handle removing old snapshots on a hourly based on a retention policy.
Features:
You'll need to give autosnap the correct permissions on your AWS account in order to function. You can use either an IAM user or role. Refer to the sample IAM policy when making your IAM policy attached to this user/role. If you're not using SNS notifications, you can remove that portion.
AWS_ACCESS_KEY_ID and AWS_SECRET_ACCESS_KEY).If you'd like to use SNS notifications, create an SNS topic in your AWS account and pass in the ARN in the config file, or as environment variable AUTOSNAP_SNS_ARN.
All the configuration parameters can be overridden by passing environment variables. The variable naming convention is as follows, AUTOSNAP_{VARIABLE_NAME}. So, for example AUTOSNAP_LOG_FILE.
docker run -d --name ebs-snapshot-service -e AWS_ACCESS_KEY_ID=[CHANGE_ME] -e AWS_SECRET_ACCESS_KEY=[CHANGE_ME] -e AUTOSNAP_SNS_ARN=[CHANGE_ME] xetusoss/ebs-snapshot-servicedocker run -d --name ebs-snapshot-service -e AWS_ACCESS_KEY_ID=[CHANGE_ME] -e AWS_SECRET_ACCESS_KEY=[CHANGE_ME] -e AUTOSNAP_DRY_RUN=true xetusoss/ebs-snapshot-serviceFor each instance or volume that you want to snapshot, add the following tags:
autosnap:X: how often (in hours) you want this instance to be snapshotted (tag name can be changed in config.py)autosnap_retention:X: how many snapshots you want to keep (if not specified, it will use the value in config.py.autsnap_ignore. The tag's value doesn't matter (it can be blank).PLEASE NOTE: volume settings will override instance settings
When this script creates a snapshot, it will tag the snapshot with snapshot_type:autosnap (or whatever tag_name is set to in config.py), along with some other useful tags. Later, when it is creating the list of snapshots to delete, it will only consider snapshots for a given volume if that tag is present. This allows you to make your own snapshots without having to worry about autosnap deleting them later (just make sure you don't tag it with 'snapshot_type:autosnap').
Content type
Image
Digest
sha256:6e519cba6…
Size
120 MB
Last updated
over 7 years ago
docker pull xetusoss/ebs-snapshot-service