terraform-aws-ec2-ami-backup

Terraform module for automatic AMI creation

Terraform AWS EC2 AMI Backup

GitHub Repo https://github.com/cloudposse/terraform-aws-ec2-ami-backup
Terraform Module terraform-aws-ec2-ami-backup
Release Release
Build Status Build Status

This repo contains a terraform module that creates two lambda functions that will create AMI automatically at regular intervals.

It is based on the code at:

Usage

Include this repository as a module in your existing terraform code:

HCL

module "lambda_ami_backup" {
  source = "git::https://github.com/cloudposse/tf_ami_backup.git?ref=tags/0.1.0"

  name              = "${var.name}"
  stage             = "${var.stage}"
  namespace         = "${var.namespace}"
  region            = "${var.region}"
  ami_owner         = "${var.ami_owner}"
  instance_id       = "${var.instance_id}"
  retention_days    = "14"
}

Variables

Name Default Description Required
namespace Namespace (e.g. cp or cloudposse) Yes
stage Stage (e.g. prod, dev, staging Yes
name Name (e.g. bastion or db) Yes
region AWS Region where module should operate (e.g. us-east-1) Yes
ami_owner AWS Account ID which is used as a filter for AMI list (e.g. 123456789012) Yes
instance_id AWS Instance ID which is used for creating the AMI image (e.g. id-123456789012) Yes
retention_days 14 Is the number of days you want to keep the backups for (e.g. 14) No
backup_schedule cron(00 19 * * ? *) The scheduling expression. (e.g. cron(0 20 __ ? * No
cleanup_schedule cron(05 19 * * ? *) The scheduling expression. (e.g. cron(0 20 __ ? * No