AWS Backup Plan

This page shows how to write Terraform and CloudFormation for AWS Backup Plan and write them securely.

aws_backup_plan (Terraform)

The Plan in AWS Backup can be configured in Terraform with the resource name aws_backup_plan. The following sections describe 3 examples of how to use the resource and its parameters.

Example Usage from GitHub

backup-plan.tf#L16
resource "aws_backup_plan" "daily_except_sunday" {
  name = "daily_except_sunday"
  rule {
    rule_name = "daily_except_sunday"
    target_vault_name = aws_backup_vault.backup_vault.name

main.tf#L50
resource "aws_backup_plan" "daily" {
  count = local.daily_backup_count
  name  = "daily"
  tags  = merge(var.tags, var.tags_plan)

  rule {
main.tf#L14
resource "aws_backup_plan" "plan1" {
  name = var.Plan_Name

  rule {
    rule_name         = var.Rule_Name
    target_vault_name = aws_backup_vault.testvault.name

Review your Terraform file for AWS best practices

Shisho Cloud, our free checker to make sure your Terraform configuration follows best practices, is available (beta).

Parameters

Explanation in Terraform Registry

Provides an AWS Backup plan resource.

AWS::Backup::BackupPlan (CloudFormation)

The BackupPlan in Backup can be configured in CloudFormation with the resource name AWS::Backup::BackupPlan. The following sections describe 10 examples of how to use the resource and its parameters.

Example Usage from GitHub

backup-tagoptions.yml#L41
    Type: "AWS::Backup::BackupPlan"
    Properties:
      BackupPlan:
        BackupPlanName: "BackupPlanWithDailyBackups"
        BackupPlanRule:
          -
backup-tagoptions.yml#L41
    Type: "AWS::Backup::BackupPlan"
    Properties:
      BackupPlan:
        BackupPlanName: "BackupPlanWithDailyBackups"
        BackupPlanRule:
          -
tag-based-backup-selection-no-parameters.yml#L34
    Type: "AWS::Backup::BackupPlan"
    Properties:
      BackupPlan:
        BackupPlanName: "BackupPlan-01"
        BackupPlanRule:
          -
awsbackup.yml#L27
    Type: AWS::Backup::BackupPlan
    Properties:
      BackupPlan:
        BackupPlanName: Daily-Weekly-Monthly
        BackupPlanRule:
          - RuleName: DailyBackups
AWS-Backup.yml#L135
    Type: "AWS::Backup::BackupPlan"
    DependsOn: BackupVault
    Properties:
      BackupPlan:
        BackupPlanName: "DailyBackupPlan"
        BackupPlanRule:
aws_backup.json#L6
      "ValueType": "AWS::Backup::BackupPlan.Id"
    }
  },
  {
    "op": "add",
    "path": "/PropertyTypes/AWS::Backup::BackupPlan.BackupRuleResourceType/Properties/TargetBackupVault/Value",
aws_backup.json#L6
      "ValueType": "AWS::Backup::BackupPlan.Id"
    }
  },
  {
    "op": "add",
    "path": "/PropertyTypes/AWS::Backup::BackupPlan.BackupRuleResourceType/Properties/TargetBackupVault/Value",
plan.json#L3
        "Type": "AWS::Backup::BackupPlan",
        "Properties": {
            "BackupPlan": {
                "BackupPlanName": { "Fn::Sub": "0x4447_openvpn_EC2_${UniqueIdentifierParam}_${AWS::Region}" },
                "BackupPlanRule": [
                    {
plan.json#L3
        "Type": "AWS::Backup::BackupPlan",
        "Properties": {
            "BackupPlan": {
                "BackupPlanName": { "Ref": "UniqueIdentifierParam" },
                "BackupPlanRule": [
                    {
plan.json#L3
        "Type" : "AWS::Backup::BackupPlan",
        "Properties" : {
            "BackupPlan" : {
                "BackupPlanName": "0x4447_SFTP",
                "BackupPlanRule": [
                    {

Parameters

Explanation in CloudFormation Registry

Contains an optional backup plan display name and an array of BackupRule objects, each of which specifies a backup rule. Each rule in a backup plan is a separate scheduled task and can back up a different selection of AWS resources.

Frequently asked questions

What is AWS Backup Plan?

AWS Backup Plan is a resource for Backup of Amazon Web Service. Settings can be wrote in Terraform and CloudFormation.

Where can I find the example code for the AWS Backup Plan?

For Terraform, the andresriancho/aws-backup, USSBA/terraform-aws-backup-plans and jitendrapsingh/Backup_RDS source code examples are useful. See the Terraform Example section for further details.

For CloudFormation, the aws-samples/aws-service-catalog-reference-architectures, mynameisakash/aws-service-catalog-reference-architectures and hiteshkacholiya/aws-reusable-solutions source code examples are useful. See the CloudFormation Example section for further details.