Git Product home page Git Product logo

aws-backup's Introduction

Automatic backups for AWS instances

This script provides functionality to create automatic snapshots of AWS EC2 instances and to rotate them by deleting the snapshots older than a given amount of days.

Usage:

  1. Create a new user (https://console.aws.amazon.com/iam/?#users) having at least following permissions:

    • CreateSnapshot
    • DeleteSnapshot
    • DescribeSnapshotAttribute
    • DescribeSnapshots
    • DescribeVolumeAttribute
    • DescribeVolumeStatus
    • DescribeVolumes
    • DescribeInstances
    • CreateTags
  2. Define following environment variables containing the credentials of the new user:

    • $AWS_BACKUP_ACCESS_KEY, i.e. AKIAIOSFODNN7EXAMPLE
    • $AWS_BACKUP_SECRET_KEY, i.e. wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
  3. Define a new environment variable $AWS_BACKUP_REGION containing the region of your machine, i.e. "eu-west-1"

  4. By default the snapshots older than 30 days are deleted. If you want to change it, you can adjust the variable $daysToKeep at the beginning of the script

  5. Run and enjoy

  6. If you want to run this script as a cron job, please add following line to the root's cronjobs (with your path to the script):

       01 01 * * * export AWS_BACKUP_ACCESS_KEY="AKIAIOSFODNN7EXAMPLE" && export AWS_BACKUP_SECRET_KEY="wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY" && export AWS_BACKUP_REGION="eu-west-1" &&  /bin/bash /home/ec2-user/aws-backup/aws-backup.sh

aws-backup's People

Contributors

aboritskiy avatar mryvlin avatar

Watchers

 avatar  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.