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
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
resource "aws_backup_plan" "daily" {
count = local.daily_backup_count
name = "daily"
tags = merge(var.tags, var.tags_plan)
rule {
resource "aws_backup_plan" "plan1" {
name = var.Plan_Name
rule {
rule_name = var.Rule_Name
target_vault_name = aws_backup_vault.testvault.name
Parameters
-
arnoptional computed - string -
idoptional computed - string -
namerequired - string -
tagsoptional - map from string to string -
versionoptional computed - string -
advanced_backup_settingset block-
backup_optionsrequired - map from string to string -
resource_typerequired - string
-
-
ruleset block-
completion_windowoptional - number -
enable_continuous_backupoptional - bool -
recovery_point_tagsoptional - map from string to string -
rule_namerequired - string -
scheduleoptional - string -
start_windowoptional - number -
target_vault_namerequired - string -
copy_actionset block-
destination_vault_arnrequired - string -
lifecyclelist block-
cold_storage_afteroptional - number -
delete_afteroptional - number
-
-
-
lifecyclelist block-
cold_storage_afteroptional - number -
delete_afteroptional - number
-
-
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
Type: "AWS::Backup::BackupPlan"
Properties:
BackupPlan:
BackupPlanName: "BackupPlanWithDailyBackups"
BackupPlanRule:
-
Type: "AWS::Backup::BackupPlan"
Properties:
BackupPlan:
BackupPlanName: "BackupPlanWithDailyBackups"
BackupPlanRule:
-
Type: "AWS::Backup::BackupPlan"
Properties:
BackupPlan:
BackupPlanName: "BackupPlan-01"
BackupPlanRule:
-
Type: AWS::Backup::BackupPlan
Properties:
BackupPlan:
BackupPlanName: Daily-Weekly-Monthly
BackupPlanRule:
- RuleName: DailyBackups
Type: "AWS::Backup::BackupPlan"
DependsOn: BackupVault
Properties:
BackupPlan:
BackupPlanName: "DailyBackupPlan"
BackupPlanRule:
"ValueType": "AWS::Backup::BackupPlan.Id"
}
},
{
"op": "add",
"path": "/PropertyTypes/AWS::Backup::BackupPlan.BackupRuleResourceType/Properties/TargetBackupVault/Value",
"ValueType": "AWS::Backup::BackupPlan.Id"
}
},
{
"op": "add",
"path": "/PropertyTypes/AWS::Backup::BackupPlan.BackupRuleResourceType/Properties/TargetBackupVault/Value",
"Type": "AWS::Backup::BackupPlan",
"Properties": {
"BackupPlan": {
"BackupPlanName": { "Ref": "UniqueIdentifierParam" },
"BackupPlanRule": [
{
"Type": "AWS::Backup::BackupPlan",
"Properties": {
"BackupPlan": {
"BackupPlanName": { "Fn::Sub": "0x4447_openvpn_EC2_${UniqueIdentifierParam}_${AWS::Region}" },
"BackupPlanRule": [
{
"Type" : "AWS::Backup::BackupPlan",
"Properties" : {
"BackupPlan" : {
"BackupPlanName": "0x4447_SFTP",
"BackupPlanRule": [
{
Parameters
-
BackupPlanrequired - BackupPlanResourceType -
BackupPlanTagsoptional - Map
Explanation in CloudFormation Registry
Contains an optional backup plan display name and an array of
BackupRuleobjects, 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.