Help us improve the AWS re:Post Knowledge Center by sharing your feedback in a brief survey. Your input can influence how we create and update our content to better support your AWS journey.
如何將資源指派給備份計劃?
我想在 AWS Backup 中為備份計劃指定資源。
解決方法
若要將資源指派給備份計劃,請使用 AWS Backup 中的資源指派。
您可以使用 AWS Backup 主控台或使用 AWS Command Line Interface (AWS CLI) 以程式設計方式建立資源指派。
**重要事項:**只有在建立了備份計劃之後,才能將資源指派給備份計劃。備份計劃中的所有規則都適用於您的資源指派。
範例
以下是在使用 AWS CLI 時如何將備份選擇 JSON 用於備份選擇的範例。您可以將這些範例與 create-backup-selection API 搭配使用。
**注意:**最佳實務是指定 Conditions、ListofTags、NotResources 和 Resources。如果未指定這些參數,則備份會選取所有受支援和已選擇的儲存資源。
範例 1
下列範例會備份標記為 backup:yes 和 owner:example 的 Amazon Elastic Block Store (Amazon EBS) 磁碟區。
**注意:**在此範例中,Resources 和 Conditions 會使用布林值 AND 來組合。
{ "BackupSelection": { "SelectionName": "Example-1", "IamRoleArn": "arn:aws:iam::111122223333:role/service-role/AWSBackupDefaultServiceRole", "Resources": ["arn:aws:ec2:\*:\*:volume/\*"], "ListOfTags": [], "NotResources": [], "Conditions": { "StringEquals": [ {"ConditionKey": "aws:ResourceTag/backup", "ConditionValue": "yes"}, {"ConditionKey": "aws:ResourceTag/owner", "ConditionValue": "example"}, ], "StringNotEquals": [], "StringLike": [], "StringNotLike": [], }, } }
範例 2
下列範例會備份所有 Amazon EBS 磁碟區或所有標記為 backup:yes 的資源。
**注意:**在此範例中,Resources 和 ListOfTags 會使用布林值 OR 來組合。
{ "BackupSelection": { "SelectionName": "Example-2", "IamRoleArn": "arn:aws:iam::111122223333:role/service-role/AWSBackupDefaultServiceRole", "Resources": ["arn:aws:ec2:\*:\*:volume/\*"], "ListOfTags": [ { "ConditionType": "STRINGEQUALS", "ConditionKey": "backup", "ConditionValue": "yes", } ], "NotResources": [], "Conditions": { "StringEquals": [], "StringNotEquals": [], "StringLike": [], "StringNotLike": [], }, } }
範例 3
下列範例會備份標記為 backup:true 和 owner:test 的 Amazon EBS 磁碟區或 Amazon Relational Database Service (Amazon RDS) 資源。
**注意:**在此範例中,Resources 中的參數會使用布林值 OR 來組合。Conditions 中的參數會使用布林值 AND 來組合。
{ "BackupSelection": { "SelectionName": "Example-3", "IamRoleArn": "arn:aws:iam::111122223333:role/service-role/AWSBackupDefaultServiceRole", "Resources": ["arn:aws:ec2:\*:\*:volume/\*", "arn:aws:rds:\*:\*:db:\*"], "ListOfTags": [], "NotResources": [], "Conditions": { "StringEquals": [ {"ConditionKey": "aws:ResourceTag/backup", "ConditionValue": "true"}, {"ConditionKey": "aws:ResourceTag/owner", "ConditionValue": "test"}, ] }, "StringNotEquals": [], "StringLike": [], "StringNotLike": [], } }
相關資訊
相關內容
- 已提問 1 年前
