joshmarsden1994 / aws-ebs-snapshots-lambda

AWS EBS Snapshot Manager using only AWS Lambda

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Overview

This is for managing AWS EC2 EBS volume snapshots. It consists of a snapshot creator and a snapshot manager.

Functionality:

  • Automatic snapshots (on whatever schedule you prefer)
  • Automated expiration of old snapshots
  • Ability to configure retention period on a per EC2 instance basis (applying to all volumes attached to said instance)
  • Ability to manually tag individual snapshots to be kept indefinitely (regardless of instance retention configuration)
  • Does not require a job/management instance; no resources to provision to run snapshot jobs (leverages AWS Lambda)

Implementation Details

It is implemented as a set of two Python based functions intended to run in AWS Lambda (which also handles the job scheduling). This makes it self-contained and easier to setup, without any external resources needed.

Configuration is done through AWS tags. It's easy to configure which instances should have their volumes backed up and how long their snapshots should be retained for. It's also possible to tag certain snapshots for indefinite retention.

The creator function is intended to be ran on a regular basis (i.e. daily), using the built-in AWS Lambda scheduler, to create snapshots for the defined instances/volumes. The manager is also intended to be ran on a regular basis (i.e. also daily, and handles snapshot expiration/retention.

This is based on code originally posted by Ryan S. Brown in Scheduling EBS Snapshots - Part I and Part II.

For the moment, read these links for documentation on how to setup/use. I've extended it a tiny bit though and need to add docs. :) For hints on changes, see the CHANGELOG

Ideas and To Do items are currently tracked in IDEAS.

Files:

Each file implements a single AWS Lambda function.

  • ebs-snapshot-creator.py
  • ebs-snapshot-manager.py

Related:

Other Relevant Resources (especially if you're going to customize):

About

AWS EBS Snapshot Manager using only AWS Lambda


Languages

Language:Python 100.0%