Created
July 20, 2019 17:18
-
-
Save quiver/12b1163e084bd4149929a9e185f1103b to your computer and use it in GitHub Desktop.
CloudFormation template to configure thin backup rules for AWS Backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
AWSTemplateFormatVersion: "2010-09-09" | |
Description: "Backup Plan template for thin backups" | |
Resources: | |
BackupVaultWithThinBackups: | |
Type: "AWS::Backup::BackupVault" | |
Properties: | |
BackupVaultName: "BackupVaultWithThinBackups" | |
BackupPlanWithThinBackups: | |
Type: "AWS::Backup::BackupPlan" | |
Properties: | |
BackupPlan: | |
BackupPlanName: "BackupPlanWithThinBackups" | |
BackupPlanRule: | |
- | |
RuleName: "RuleForDailyBackups" | |
TargetBackupVault: !Ref BackupVaultWithThinBackups | |
ScheduleExpression: "cron(0 5 ? * * *)" | |
Lifecycle: | |
DeleteAfterDays: 7 | |
- | |
RuleName: "RuleForWeeklyBackups" | |
TargetBackupVault: !Ref BackupVaultWithThinBackups | |
ScheduleExpression: "cron(0 5 ? * 1 *)" | |
Lifecycle: | |
DeleteAfterDays: 28 | |
- | |
RuleName: "RuleForMonthlyBackups" | |
TargetBackupVault: !Ref BackupVaultWithThinBackups | |
ScheduleExpression: "cron(0 5 1 * ? *)" | |
Lifecycle: | |
DeleteAfterDays: 90 | |
DependsOn: BackupVaultWithThinBackups | |
TagBasedBackupSelection: | |
Type: "AWS::Backup::BackupSelection" | |
Properties: | |
BackupSelection: | |
SelectionName: "TagBasedBackupSelection" | |
IamRoleArn: !Sub "arn:aws:iam::${AWS::AccountId}:role/service-role/AWSBackupDefaultServiceRole" | |
ListOfTags: | |
- | |
ConditionType: "STRINGEQUALS" | |
ConditionKey: "backup" | |
ConditionValue: "thinbackup" | |
BackupPlanId: !Ref BackupPlanWithThinBackups | |
DependsOn: BackupPlanWithThinBackups | |
This CFn template is intended for basic/default usage.
Please customize it for your specific use case.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Is it all using the default role and dynamodb? What if someone uses a default vault?