Use these templates to create Lambda functions for snapshot backup and cleanup stratergy. This is not configured to use S3 backend.
Download the source code for lambda functions in ../code/
from here. Once downloaded, zip the individual functions and append the environment name. Following commands assume the environment = production
, replace the values suitably before execution.
mkdir code && cd code
wget https://github.com/abiydv/python/archive/master.zip
unzip -p master.zip python-master/ebs-snapshot-backup/ebs-snapshot-backup.py > ./production-ebs-snapshot-backup.py
unzip -p master.zip python-master/ebs-snapshot-backup/ebs-snapshot-cleanup.py > ./production-ebs-snapshot-cleanup.py
zip production-ebs-snapshot-backup.zip production-ebs-snapshot-backup.py
zip production-ebs-snapshot-cleanup.zip production-ebs-snapshot-cleanup.py
Once the source code is in place, execute the Terraform template to create the Lambdas, SNS topic, Cloudwatch events etc.
cd ../lambda/
terraform init
terraform plan
terraform apply
Drop me a note or open an issue if something doesn't work out.
Cheers! 👍