This is a quick implementation of an EBS backup solution with Terraform and Lambda.
It can be executed out of the box by installing Terraform and running the deployment steps below.
Use these steps to deploy the test.
-
Create an S3 bucket for the terraform state.
-
Make sure you're using the latest Terraform. This was tested with Terraform 0.11.7.
-
Run the following command:
cd terraform/test cp backend.tfvars.example backend.tfvars cp terraform.tfvars.example terraform.tfvars
-
Fill out backend.tfvars with the name of the S3 bucket you just created.
-
Fill out terraform.tfvars with required values. At a minimum, required variables for this repo are "environment" and "ebs_backup_sns_subscription_addresses". "Environment" is type "string" and "ebs_backup_sns_subscription_addresses" is a terraform list variable.
-
Run the init:
terraform init --backend-config="backend.tfvars"
-
Run a plan to make sure everything is fine and ready to go:
terraform plan
-
If there are no issues, apply the stack:
terraform apply
The address that was configured in the variable "ebs_backup_sns_subscription_addresses" will be asked to confirm the SNS subscription in email. You MUST confirm with the link in the email to receive notifications from the Lambda scripts.
The lambda function code used in this terraform module is adapted from this link