All Projects → cevoaustralia → aws-backup-lambda

cevoaustralia / aws-backup-lambda

Licence: MIT license
A utility AWS lambda function to manage EBS and RDS snapshot backups.

Programming Languages

python
139335 projects - #7 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to aws-backup-lambda

aws-tag-sched-ops
Retired, please see https://github.com/sqlxpert/lights-off-aws
Stars: ✭ 24 (-60%)
Mutual labels:  backup, snapshot, ebs, rds
terraform-aws-efs-backup
Terraform module designed to easily backup EFS filesystems to S3 using DataPipeline
Stars: ✭ 40 (-33.33%)
Mutual labels:  lambda, backup, snapshot
ebs-backup
Backup EBS Volumes
Stars: ✭ 34 (-43.33%)
Mutual labels:  lambda, backup, ebs
terraform-aws-backup
Terraform module to provision AWS Backup, a fully managed backup service that makes it easy to centralize and automate the back up of data across AWS services such as EBS volumes, RDS databases, DynamoDB tables, EFS file systems, and AWS Storage Gateway volumes.
Stars: ✭ 62 (+3.33%)
Mutual labels:  backup, ebs, rds
ebsautotagger
AWS Lambda function to tag EBS volumes created by autoscaling
Stars: ✭ 18 (-70%)
Mutual labels:  lambda, ebs
instance-watcher
Get notified for Instances mistakenly left running across all AWS regions for specific AWS Account
Stars: ✭ 90 (+50%)
Mutual labels:  lambda, rds
Content Lambda Boto3
Automating AWS with Lambda, Python, and Boto3
Stars: ✭ 91 (+51.67%)
Mutual labels:  lambda, backup
Komiser
☁️ Cloud Environment Inspector 👮🔒 💰
Stars: ✭ 2,684 (+4373.33%)
Mutual labels:  lambda, rds
Knoxite
A data storage & backup system
Stars: ✭ 165 (+175%)
Mutual labels:  backup, snapshot
Aws Cli Cheatsheet
☁️ AWS CLI + JQ = Make life easier
Stars: ✭ 94 (+56.67%)
Mutual labels:  lambda, rds
virt-backup
Fully backup your KVM Virtual Machines
Stars: ✭ 27 (-55%)
Mutual labels:  backup, snapshot
herman
Herman is a tool to simplify deployment of AWS Services using ECS and Lambda, and the provisioning of various AWS services.
Stars: ✭ 33 (-45%)
Mutual labels:  lambda, rds
super-serverless-sample
Backend serverless que simula o sistema de votação do BBB
Stars: ✭ 30 (-50%)
Mutual labels:  lambda, rds
Awesome Aws
A curated list of awesome Amazon Web Services (AWS) libraries, open source repos, guides, blogs, and other resources. Featuring the Fiery Meter of AWSome.
Stars: ✭ 9,895 (+16391.67%)
Mutual labels:  lambda, rds
adlibre-backup
High performance rsync backup utilising BTRFS / ZFS filesystem features
Stars: ✭ 35 (-41.67%)
Mutual labels:  backup, snapshot
shelvery-aws-backups
Automating EBS RDS EC2 backups on lambda
Stars: ✭ 31 (-48.33%)
Mutual labels:  lambda, backup
Awstaghelper
AWS bulk tagging tool
Stars: ✭ 98 (+63.33%)
Mutual labels:  lambda, rds
Btrfs Sxbackup
Incremental btrfs snapshot backups with push/pull support via SSH
Stars: ✭ 105 (+75%)
Mutual labels:  backup, snapshot
Backy2
backy2: Deduplicating block based backup software for ceph/rbd, image files and devices
Stars: ✭ 126 (+110%)
Mutual labels:  backup, snapshot
ebs-snapshot-lambda
AWS lambda function to snapshot EBS volumes and purge old snapshots.
Stars: ✭ 37 (-38.33%)
Mutual labels:  lambda, snapshot

aws-backup-lambda

Build Status

A utility AWS lambda function to manage EBS and RDS snapshot backups.

The Lambda function takes new backups when executed, and manages the deletion of the old ones when the upper limit is reached.

The origin of this project comes from: https://github.com/evannuil/aws-snapshot-tool

Dependencies

The tool uses the supplied boto3 library to connect to the AWS account, and uses the IAM Role defined in the CloudFormation stack to enable access to the required assets.

The only external dependency is on the pytz library for some basic time processing functions.

Lambda Deployment

To deploy the lambda code you can run the supplied upload_lambda.sh script, or modify it for your purposes.

The lambda deployment process requires an s3 bucket to store the code before deployment, so before running the script you need create the bucket and export a BUCKET environment variable for the script to use.

for example:

export REGION=ap-southeast-2
export BUCKET="lambdabucket1978"
aws s3 mb s3://${BUCKET} --region ${REGION}

Once the BUCKET and optional REGION variables are set, when you run upload_lambda.sh it will do the following:

  • Use pip to install the pytz library alongside the python lambda function
  • Use cloudformation package to zip up the application and upload to s3
  • As part of the cloudformation package, a new generated-cloudformation.yaml file will be created with the CodeUri pointing at the newly uploaded zip file
  • Invoke a cloudformation deploy to execute the creation of a new stack named aws-backup-lambda

Once complete, you should have a new CloudFormation stack, which will have created the Lambda and all required AWS assets

Configuring the lambda

The configuration of the lambda is detailed in the cloudformation.yaml template file.

Things you might want to review and change are:

  • The frequency of the backups
  • The tags used for the snapshots
  • The date based labels to use for each snapshot
  • The number of snapshots to keep
  • Enable / Disable the EBS or RDS backup function

The configuration for the Lambda is managed as the Input passed to the function from the Scheduled event trigger.

An example configuration might be:

{
    "period_label": "day",
    "period_format": "%a",
    "keep_count": 14,

    "ec2_region_name": "ap-southeast-2",
    "rds_region_name": "ap-southeast-2",

    "tag_name": "MakeSnapshot",
    "tag_value": "True"
}
  • period_label is used to identify all backups in the same set, ensure this is UNIQUE across each scheduled event
  • period_format is the format of the current time to apply to each of the backups, more detail below
  • keep_count the number of snapshots to keep for each period_label
  • ec2_region_name if supplied, EBS volumes for the specified region will be included in the backup run
  • rds_region_name if supplied, RDS instances for the specified region will be included in the backup run
  • tag_name the RDS and EBS items need to have this tag name to be considered part of the backup
  • tag_value the RDS and EBS items need to have this tag value to be considered part of the backup

Supported AWS services

Both EBS and RDS Snapshot management is supported and enabled by default.

Control of which service is executed is identified by the suppling the region name for the service.

  • Supply ec2_region_name to run the EBS snapshot process
  • Supply rds_region_name to run the RDS snapshot process

Note: Currently the backup function only runs against a single region, you could easily add another copy of the function to run against an additional region.

Note: For RDS cluster support just add tag_name, tag_value to one of the instance in the cluster

Both of these services will use the same field for tag_name, tag_value and the keep_count fields, if you need them to differ then create another Event trigger with different parameters.

Backup label format

The syntax used to label the backups with a value indicating the current time of the backup.

Any python time format string will be supported, with a set of suggested values shown below.

Suggested settings:

  • More often than a day: %a%H - show the day of the week and the hour of the day
  • Daily: %a - show the day of the week
  • Weekly: %U - show the week of the year
  • Monthly: %b - show the month
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].