Service to automate creation and cleanup of Amazon EBS snapshots
2.3K
ebs-snapshots allows you to create and clean up AWS EBS snapshots according to a schedule.
(Thanks for skymill for the basis of this work: https://github.com/skymill/automated-ebs-snapshots)
AWS_ACCESS_KEY=your_key \
AWS_SECRET_KEY=your_secret \
AWS_REGION=your_region \
BACKUP_CONFIG=s3://your-bucket/snapshots-config.yml \
python main.py
This starts a long-running process that will take snapshots according to the config file.
BACKUP_CONFIG may be a local file, an s3 path, or inline YAML/JSON.
Configuration files are written in yaml (a superset of JSON) format. Top level keys are volume ids. These map to a dict of parameters:
interval - frequency of snapshots: hourly, daily, monthly, yearlymax_snapshots - max snapshots to keep, 0 keeps allname - name of snapshot, written to EC2 tag 'Name"Here is an example configuration file to automate snapshots for two volumes:
vol-fake1234:
interval: daily
max_snapshots: 0
name: Fake database
vol-fake5678:
interval: hourly
max_snapshots: 48
You must specify these env vars in order to connect to AWS and to choose the configuration file.
AWS_ACCESS_KEY # Your AWS Credentials
AWS_SECRET_KEY # Your AWS Credentials
AWS_REGION # AWS Region, e.g. us-west-1
CONFIG_PATH # Path to backup config. May be local file or s3 path (see "Configuration")
You'll need to grant the proper IAM permissions to the AWS credentials you're using.
See the included example policy.
Build the docker image:
docker build --tag=local/ebs-snapshots $(pwd)
Run as a docker container, making sure to specify required env vars:
docker run \
-e AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \
-e AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \
-e AWS_REGION=$AWS_REGION \
-e BACKUP_CONFIG=$BACKUP_CONFIG \
local/ebs-snapshots
make test
Content type
Image
Digest
Size
308.9 MB
Last updated
over 10 years ago
docker pull monder/ebs-snapshots