Skip to main content

Prune EBS snapshots based on a simple backup retention policy

Project description

Prune EBS Snapshots based on a simple backup retention policy

Configuration

This script uses the boto3 library to communicate with AWS. You must configure your AWS credentials using one of the methods supported by boto3. For full details see:

https://boto3.readthedocs.io/en/latest/guide/configuration.html#guide-configuration

The AWS user must have appropriate permissions. Here is an example AWS policy:

{
        "Version": "2012-10-17",
        "Statement": [
                {
                        "Sid": "Stmt1422916495000",
                        "Effect": "Allow",
                        "Action": [
                                "ec2:DeleteSnapshot",
                                "ec2:DescribeSnapshots"
                        ],
                        "Resource": [
                                "*"
                        ]
                }
        ]
}

Usage

Always use the --help option to see the most up-to-date options available.

Basic usage is:

prune-ebs-snapshots [options] volume_id tag_name tag_value

volume_id specifies which EBS volume to prune snapshots for

tag_name and tag_value specify a tag and corresponding value that must be present on all snapshots considered for pruning. Typically you would configure a backup script to include this particular tag value on all snapshots created for backup purposes. Snapshots created for other purposes would not have this tag, and therefore would not be deleted by this pruning script, or considered as part of the backup set for determining which snapshots to delete.

Options are used to specify how many daily, weekly, monthly and yearly snapshots to retain. Use --help for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

prune-ebs-snapshots-0.5.0.tar.gz (7.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

prune_ebs_snapshots-0.5.0-py2.py3-none-any.whl (10.0 kB view details)

Uploaded Python 2Python 3

File details

Details for the file prune-ebs-snapshots-0.5.0.tar.gz.

File metadata

File hashes

Hashes for prune-ebs-snapshots-0.5.0.tar.gz
Algorithm Hash digest
SHA256 144fe0481798eaeb4723df077d39311c3bce8e8c09e4440aa077632eb61801b7
MD5 eb9f97bdfcf16721a9dd71ff087bfdab
BLAKE2b-256 94d749b7d40ad03be1be21268751d614b10cbd8e1552acdb2d4a351711fb8301

See more details on using hashes here.

File details

Details for the file prune_ebs_snapshots-0.5.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for prune_ebs_snapshots-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 6064e54d127d8fa834a6b807610b1fd52512f1c114d757fafcffc3e05a5ecdf1
MD5 300c57d770432e1fe67f2cccb526a83a
BLAKE2b-256 57e0bd74c30ac4e2b427c959fd42a426a7ed10d7ec136897b05728935fb4d8b4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page