Created
April 6, 2019 00:30
-
-
Save MatthewJDavis/8d37b23e6d8bf4a5c0f9be7a8d9e99bc to your computer and use it in GitHub Desktop.
Create a new backup plan selection based on a tag value
This file contains hidden or 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
| # Resource selection https://docs.aws.amazon.com/sdkfornet/v3/apidocs/index.html?page=Backup/TBackupCondition.html&tocid=Amazon_Backup_Model_Condition | |
| $BackupSelectionName = '4AM-7-Day-Retention-Tag' | |
| $IAMRoleARN = (Get-IAMRole -RoleName AWSBackupDefaultServiceRole).arn # using the default created role here | |
| $BackupCondition = New-Object -TypeName Amazon.Backup.Model.Condition | |
| $BackupCondition.ConditionKey = 'BackupPolicy' | |
| $BackupCondition.ConditionValue = '4AM-7-Day-Retention' | |
| $BackupCondition.ConditionType = 'STRINGEQUALS' | |
| New-BAKBackupSelection -BackupPlanId $BackupPlan.BackupPlanId -BackupSelection_SelectionName $BackupSelectionName -BackupSelection_ListOfTag $BackupCondition -BackupSelection_IamRoleArn $IAMRoleARN |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment