Skip to content

Scheduled backups of EBS volumes using Lambda - provisioned via Terraform on AWS

License

Notifications You must be signed in to change notification settings

gabormay/ebs-backups

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

EBS Backups

Scheduled backups of EBS volumes using Lambda - provisioned via Terraform

Prerequisites

  • Install Terraform
  • Have zip available on the PATH

Usage

  • Make sure to have your AWS credentials set up properly. Normally these are picked up from the following standard environment variables: AWS_ACCESS_KEY_ID, AWS_SECRET_ACCESS_KEY and AWS_DEFAULT_REGION. Alternatively, you can enter these parameters directly in main.tf but this is not recommended.
  • (optional) Review and adjust the schedule and the backup retention policies in lambda.tf and lambda_ebs_backup.py
  • Run the following commands to provision the lambda function to AWS:
    • ./build.sh
    • (optional) terraform plan
    • terraform apply
  • Add the tag Backup to all volumes you want to include in the backup process. The value of the tag is indifferent, use e.g. daily.

Cleaning up

Run terraform destroy to clean up and delete all associated resources from AWS. Note that this needs the terraform.tfstate that was created during the provisioning step above.

Known limitations, TODOs

  • AWS Lambda requires the function package to be uploaded as a zip file. However, Terraform does not provide any support in creating a zip file yet, hence we need the extra 'build' step.
  • Currently the backup schedule as well as the backup retention policies are hard-wired into the code. A possible improvement would be to have them configurable.

About

Scheduled backups of EBS volumes using Lambda - provisioned via Terraform on AWS

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published