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
-
arn
optional computed - string -
id
optional computed - string -
name
required - string -
tags
optional - map from string to string -
version
optional computed - string -
advanced_backup_setting
set block-
backup_options
required - map from string to string -
resource_type
required - string
-
-
rule
set block-
completion_window
optional - number -
enable_continuous_backup
optional - bool -
recovery_point_tags
optional - map from string to string -
rule_name
required - string -
schedule
optional - string -
start_window
optional - number -
target_vault_name
required - string -
copy_action
set block-
destination_vault_arn
required - string -
lifecycle
list block-
cold_storage_after
optional - number -
delete_after
optional - number
-
-
-
lifecycle
list block-
cold_storage_after
optional - number -
delete_after
optional - 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
-
BackupPlan
required - BackupPlanResourceType -
BackupPlanTags
optional - Map
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.