CloudFormation - Importing existing AWS Backup

0

Hi,

I have an existing AWS Backup setup for Aurora, which I created via the console UI. I have now put together a cloudformation template for that which I'd like to import - I'm following through the import with existing resources wizard, but hitting an error I'm unable to understand.

After selecting the new template I am asked to enter on the UI

AWS::Backup::BackupVault - BackupVaultName

AWS::Backup::BackupPlan - BackupPlanId

AWS::Backup::BackupSelection - Id

On entering these value and then hitting next a few times to get to the final screen. It will load for a few moments calculating the change set and then say "Backup Plan ID and Selection ID must be provided" Although I do enter those values during the wizard. Any suggestions? Thanks

Template below - This work all as expected if the Backup Plan does not currently exist

AWSTemplateFormatVersion: 2010-09-09
Description: >-
  Create RDS Backup
Parameters:
  OnlyCreateVault:
    Description:
      This is for the DR region. Only other required parameters are Environment and CostAllocation
    Type: String
    Default: false      
    AllowedValues: [true, false]
  DestinationBackupVaultArn:
    Type: String
  ResourceSelectionIamRoleArn:
    Type: String
  ResourceSelectionArn:
    Description: Comma separated list of resource ARNs
    Type: String        
  CostAllocation:
    Type: String
    AllowedValues:  
      - 'Dev'
      - 'Demo'
      - 'Test'
      - 'Live'
  Environment:
    Type: String
    AllowedValues:  
      - 'develop'
      - 'testing'
      - 'testenv'
      - 'demo'
      - 'live'
      - 'dr'
Conditions:
  CreateAllResources: !Equals [!Ref OnlyCreateVault, false]  
Resources:
  Vault:
    Type: AWS::Backup::BackupVault
    DeletionPolicy: Delete
    Properties: 
      BackupVaultName: !Sub backup-vault-${Environment}-rds-1
      BackupVaultTags: 
        CostAllocation: !Ref CostAllocation
  Plan:
    Condition: CreateAllResources
    Type: AWS::Backup::BackupPlan
    DeletionPolicy: Delete
    Properties: 
      BackupPlan: 
          BackupPlanName: !Sub backup-plan-${Environment}-rds-1
          BackupPlanRule: 
            - RuleName: !Sub backup-rule-${Environment}-daily-1
              CompletionWindowMinutes: 720
              CopyActions: 
                - DestinationBackupVaultArn: !Ref DestinationBackupVaultArn
                  Lifecycle: 
                    DeleteAfterDays: 7          
              EnableContinuousBackup: true
              Lifecycle: 
                DeleteAfterDays: 35
              StartWindowMinutes: 120
              ScheduleExpression: cron(0 1 ? * * *)
              TargetBackupVault: !Sub backup-vault-${Environment}-rds-1

            - RuleName: !Sub backup-rule-${Environment}-weekly-1
              CompletionWindowMinutes: 720
              CopyActions: 
                - DestinationBackupVaultArn: !Ref DestinationBackupVaultArn
                  Lifecycle: 
                    DeleteAfterDays: 35          
              EnableContinuousBackup: false
              Lifecycle: 
                DeleteAfterDays: 42
              StartWindowMinutes: 120
              ScheduleExpression: cron(0 1 ? * * *)
              TargetBackupVault: !Sub backup-vault-${Environment}-rds-1

            - RuleName: !Sub backup-rule-${Environment}-monthly-1
              CompletionWindowMinutes: 720
              CopyActions: 
                - DestinationBackupVaultArn: !Ref DestinationBackupVaultArn
                  Lifecycle: 
                    MoveToColdStorageAfterDays: 365      
              EnableContinuousBackup: false
              Lifecycle: 
                DeleteAfterDays: 365
              StartWindowMinutes: 120
              ScheduleExpression: cron(0 1 ? * * *)
              TargetBackupVault: !Sub backup-vault-${Environment}-rds-1
      BackupPlanTags: 
         CostAllocation:
            Ref: CostAllocation
  ResourceSelection:    
    Condition: CreateAllResources
    Type: AWS::Backup::BackupSelection
    DeletionPolicy: Delete
    Properties: 
      BackupPlanId: !Ref Plan
      BackupSelection:         
        IamRoleArn: !Ref ResourceSelectionIamRoleArn   
        Resources: !Split [",", !Ref ResourceSelectionArn]
        SelectionName: !Sub backup-resource-${Environment}-rds-1         
  
asked 2 years ago156 views
No Answers

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions