Skip to content

Auto-generated

This page is generated by terraform-docs at build time from the infra/ repo. Do not edit manually.

AWS Backup plan

One backup vault, one plan and one explicit selection per environment, with the IAM role AWS Backup assumes to take and restore the backups. Part of the account security baseline (IS-120, follow-up to IS-67).

Two rules, both at the same hour:

  • daily, kept daily_retention_days
  • monthly, on the 1st, kept monthly_retention_days

On the 1st both rules fall in the same window; AWS Backup then takes a single backup and keeps it for the longer of the two retentions.

Resources are selected by ARN, never by tag, so nothing joins the plan by accident. No cold storage: the EBS archive tier has a 90-day minimum and 24-72 h restores, which does not fit short retentions.

The vault uses the AWS-managed aws/backup key. EBS and RDS recovery points keep the source resource's own encryption key regardless, so the backup role needs those keys to allow IAM-delegated access (each key policy's root statement) or to name the role explicitly.

When alarm_actions is set, a CloudWatch alarm fires on any failed, aborted or expired job in the vault: the plan this replaces failed every day for 19 months without anyone noticing.

Requirements

Name Version
terraform >= 1.6.0
aws ~> 6.0

Providers

Name Version
aws ~> 6.0

Modules

No modules.

Resources

Name Type
aws_backup_plan.this resource
aws_backup_selection.this resource
aws_backup_vault.this resource
aws_cloudwatch_metric_alarm.jobs_failed resource
aws_iam_role.this resource
aws_iam_role_policy_attachment.backup resource
aws_iam_role_policy_attachment.restore resource
aws_iam_policy_document.assume_role data source

Inputs

Name Description Type Default Required
alarm_actions SNS topic ARNs notified when a job fails, aborts or expires. Empty creates no alarm. list(string) [] no
base_tags Base tags for all resources. map(string) {} no
completion_window_minutes Minutes a job may run before AWS Backup marks it expired. Must cover the largest first (full) snapshot. number 720 no
daily_retention_days Days each daily recovery point is kept. number 14 no
monthly_retention_days Days each monthly recovery point (taken on the 1st) is kept. 60 keeps the two most recent monthlies. number 60 no
name Name of the plan and selection, and prefix for the vault (<name>-vault), role (<name>-role) and alarm. string n/a yes
resource_arns ARNs of the resources to back up (EBS volumes, RDS instances ...). Explicit by design: nothing is selected by tag. list(string) n/a yes
start_hour_utc Hour (UTC, 0-23) the daily and monthly jobs start. Keep it clear of the RDS backup and maintenance windows of the selected databases. number 1 no

Outputs

Name Description
plan_id ID of the backup plan.
role_arn ARN of the IAM role AWS Backup assumes. Pass it to modules whose KMS key policy grants the backup role explicitly (e.g. the vault ClickHouse module's backup_role_arn).
vault_name Name of the backup vault.