Giter Site home page Giter Site logo

lambda-ebs-snapshots's Introduction

Lambda EBS Snapshot Manager


A simple Lambda script to schedule creation and clearing of EBS snapshots.

  • This function can create and manage many volumes and snapshots.
  • To tag an EBS volume for backup, add a tag key "Backup" with the rate in which to snapshot.
  • Optionally, add the key "Retention" with the number of days to override the default amount in the function.
  • Old snapshots are automatically purged once the "DeleteAfter" timestamp has passed.
  • Snapshots will try to inherit the EBS volume tagged Name, but will always at least indicate the source EBS volume ID and time of snapshot in the snapshot name and decription.

Valid values for "Backup" key: true, daily, 1/day, 2/day, 4/day, 6/day, 8/day, 12/day, 24/day, hourly

EBS Volume tagging example

Lambda config:

  • Runtime: Python 2.7
  • Handler: lambda_function.lambda_handler
  • Role: [role as specified below]
  • Memory: 128
  • Timeout: 5 sec
  • Add a trigger using "CloudWatch Events - Schedule", set for "rate(1 hour)"

IAM Lambda Role:

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Effect": "Allow",
            "Action": [
                "logs:*"
            ],
            "Resource": "arn:aws:logs:*:*:*"
        },
        {
            "Effect": "Allow",
            "Action": [
                "ec2:DescribeVolumes",
                "ec2:DescribeSnapshots",
                "ec2:CreateSnapshot",
                "ec2:DeleteSnapshot",
                "ec2:CreateTags",
                "ec2:ModifySnapshotAttribute",
                "ec2:ResetSnapshotAttribute"
            ],
            "Resource": [
                "*"
            ]
        }
    ]
}

This project is a fork of powerupcloud/EBSSnapshotsLambda, but I believe the initial work was done by serverlesscode.com.

lambda-ebs-snapshots's People

Contributors

brayyy avatar powerupcloud avatar mjulian avatar sarkis avatar

Watchers

 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.