使用 AWS Backup 的 Cloud Formation 模板并尝试使我的备份计划灵活
BackupPlanProd:
Type: "AWS::Backup::BackupPlan"
Properties:
BackupPlan:
BackupPlanName: !Sub 'BACKUP-PLAN-PROD-${AWS::StackName}'
AdvancedBackupSettings:
- ResourceType: EC2
BackupOptions:
WindowsVSS: !Ref VSSConsistent
BackupPlanRule:
- RuleName: !Sub Daily-${DailyBackupsRetentionProd}d-retention
TargetBackupVault: !Ref BackupVaultProd
ScheduleExpression: "cron(0 4 ? * 2,3,4,6,1,5 *)"
StartWindowMinutes: 60
Lifecycle:
DeleteAfterDays: !Ref DailyBackupsRetentionProd
CopyActions:
- DestinationBackupVaultArn: !If
- HasDisasterRecoveryDailyProd
- !If
- HasDisasterRecoveryCrossAccount
- !Sub 'arn:aws:backup:${DisasterRecoveryRegion}:${DisasterRecoveryAccountId}:backup-vault:Default'
- !Sub 'arn:aws:backup:${DisasterRecoveryRegion}:${AWS::AccountId}:backup-vault:Default'
- !Ref "AWS::NoValue"
Lifecycle:
DeleteAfterDays: !If [HasDisasterRecoveryDailyProd, !Ref DisasterRecoveryDailyBackupsRetentionProd, !Ref "AWS::NoValue"]
这是属性“ CopyActions ”的问题,其中“ DestinationBackupVaultArn ”根据文档是必需的属性,在这种情况下使用 AWS::NoValue 是不可接受的将导致错误:
资源 BackupPlanProd 的属性验证失败,消息为:#/BackupPlan/BackupPlanRule/0/CopyActions/0:找不到所需的密钥 [DestinationBackupVaultArn]
在这种情况下,是否有任何解决方法可以在不复制模板中的整个资源的情况下使属性“CopyActions”成为条件?例如,如果我不想启用备份复制取决于我的条件。
谢谢 :)