Giter Club home page Giter Club logo

aws-snapshots's Introduction

AWS EBS Snapshots

This simple utility allows you to automatically snapshot EBS volumes across your AWS account(s).

The script is designed to be executed directly from the CLI or some automated process that provides the flags.

Version

1.0

Process

The process of the script is as follows:

  1. Look for volumes with a tag and tag value (--tag, --tag-value)
  2. Loop over each volume and check the value of the retention (--tag-retention) and frequency (--tag-frequency) tags
  3. Determine if the volume requires a snapshot to be taken based on the frequency, last snapshot taken, and current date/time
  4. Determine if the volume has any old snapshots that fall outside of the retention policy and delete them

Tag & Tag Value

This is the tag used for finding the volumes to begin with. It looks for --tag (default: snapshotbackup) and a value of --tag-value (default: true).

Frequency

The frequency tag is in minutes. It's how often you want to take a snapshot of the volume in minutes.

The tag name defaults to snapshotbackup_frequency, but no default frequency policy is assumed.

Retention

The retention tag is in days. It's how many days you want to retain snapshots for before they're deleted.

The tag name defaults to snapshotbackup_retention, but no default retention policy is assumed.

Command Line Usage

See -h for usage details.

AWS Authentication

To authenticate to AWS, you have several options:

  1. CLI flags
  2. AWS credentials/config file
  3. Point (2) + Profiles
  4. Point (3) + Security Token Service

Command Line Flags

You can use three arguments on the CLI to authenticate against AWS:

  1. --region
  2. --access-key
  3. --access-key-secret

These should be self explanatory to anyone who is familiar with AWS.

AWS Credentials File

If you use the AWS credentials or configuration files then you can simply leave the work to the boto library and it'll authenticate automatically for you.

Profiles

If you use profiles within your credentials or config files, however, then you can use the --profile flag to tell boto which profile to use.

AWS STS

If you need to assume an IAM role via STS, boto helps take care of this for you.

All you have to do is create/update your ~./aws/config file to include a few additional flags under the relevant profile name. The profile name also needs to take on a particular format. See the Boto3 documentation for more details on formatting.

To add a new profile which can assume a role, see the Boto3 documentation on the Assume Role Provider. In short, with a few file changes it should be abstracted for you by boto.

Lambda Support

Lambda support was removed until it can be integrated in a nicer manner (versus just calling main(), which doesn't work anymore.)

Author

Michael Crilly.

License

MIT

aws-snapshots's People

Contributors

mrcrilly avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.