AWS Backup

2021/11/10 - AWS Backup - 2 updated api methods

Changes  AWS Backup SDK provides new options when scheduling backups: select supported services and resources that are assigned to a particular tag, linked to a combination of tags, or can be identified by a partial tag value, and exclude resources from their assignments.

CreateBackupSelection (updated) Link ¶
Changes (request)
{'BackupSelection': {'Conditions': {'StringEquals': [{'ConditionKey': 'string',
                                                      'ConditionValue': 'string'}],
                                    'StringLike': [{'ConditionKey': 'string',
                                                    'ConditionValue': 'string'}],
                                    'StringNotEquals': [{'ConditionKey': 'string',
                                                         'ConditionValue': 'string'}],
                                    'StringNotLike': [{'ConditionKey': 'string',
                                                       'ConditionValue': 'string'}]},
                     'NotResources': ['string']}}

Creates a JSON document that specifies a set of resources to assign to a backup plan. Resources can be included by specifying patterns for a ListOfTags and selected Resources .

For example, consider the following patterns:

  • Resources: "arn:aws:ec2:region:account-id:volume/volume-id"

  • ConditionKey:"department" ConditionValue:"finance" ConditionType:"StringEquals"

  • ConditionKey:"importance" ConditionValue:"critical" ConditionType:"StringEquals"

Using these patterns would back up all Amazon Elastic Block Store (Amazon EBS) volumes that are tagged as "department=finance" , "importance=critical" , in addition to an EBS volume with the specified volume ID.

Resources and conditions are additive in that all resources that match the pattern are selected. This shouldn't be confused with a logical AND, where all conditions must match. The matching patterns are logically put together using the OR operator. In other words, all patterns that match are selected for backup.

See also: AWS API Documentation

Request Syntax

client.create_backup_selection(
    BackupPlanId='string',
    BackupSelection={
        'SelectionName': 'string',
        'IamRoleArn': 'string',
        'Resources': [
            'string',
        ],
        'ListOfTags': [
            {
                'ConditionType': 'STRINGEQUALS',
                'ConditionKey': 'string',
                'ConditionValue': 'string'
            },
        ],
        'NotResources': [
            'string',
        ],
        'Conditions': {
            'StringEquals': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringNotEquals': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringLike': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringNotLike': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ]
        }
    },
    CreatorRequestId='string'
)
type BackupPlanId

string

param BackupPlanId

[REQUIRED]

Uniquely identifies the backup plan to be associated with the selection of resources.

type BackupSelection

dict

param BackupSelection

[REQUIRED]

Specifies the body of a request to assign a set of resources to a backup plan.

  • SelectionName (string) -- [REQUIRED]

    The display name of a resource selection document.

  • IamRoleArn (string) -- [REQUIRED]

    The ARN of the IAM role that Backup uses to authenticate when backing up the target resource; for example, arn:aws:iam::123456789012:role/S3Access .

  • Resources (list) --

    An array of strings that contain Amazon Resource Names (ARNs) of resources to assign to a backup plan.

    • (string) --

  • ListOfTags (list) --

    An array of conditions used to specify a set of resources to assign to a backup plan; for example, "StringEquals": {"ec2:ResourceTag/Department": "accounting" . Assigns the backup plan to every resource with at least one matching tag.

    • (dict) --

      Contains an array of triplets made up of a condition type (such as StringEquals ), a key, and a value. Conditions are used to filter resources in a selection that is assigned to a backup plan.

      • ConditionType (string) -- [REQUIRED]

        An operation, such as StringEquals , that is applied to a key-value pair used to filter resources in a selection.

      • ConditionKey (string) -- [REQUIRED]

        The key in a key-value pair. For example, in "ec2:ResourceTag/Department": "accounting" , "ec2:ResourceTag/Department" is the key.

      • ConditionValue (string) -- [REQUIRED]

        The value in a key-value pair. For example, in "ec2:ResourceTag/Department": "accounting" , "accounting" is the value.

  • NotResources (list) --

    • (string) --

  • Conditions (dict) --

    • StringEquals (list) --

      • (dict) --

        • ConditionKey (string) --

        • ConditionValue (string) --

    • StringNotEquals (list) --

      • (dict) --

        • ConditionKey (string) --

        • ConditionValue (string) --

    • StringLike (list) --

      • (dict) --

        • ConditionKey (string) --

        • ConditionValue (string) --

    • StringNotLike (list) --

      • (dict) --

        • ConditionKey (string) --

        • ConditionValue (string) --

type CreatorRequestId

string

param CreatorRequestId

A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice.

rtype

dict

returns

Response Syntax

{
    'SelectionId': 'string',
    'BackupPlanId': 'string',
    'CreationDate': datetime(2015, 1, 1)
}

Response Structure

  • (dict) --

    • SelectionId (string) --

      Uniquely identifies the body of a request to assign a set of resources to a backup plan.

    • BackupPlanId (string) --

      Uniquely identifies a backup plan.

    • CreationDate (datetime) --

      The date and time a backup selection is created, in Unix format and Coordinated Universal Time (UTC). The value of CreationDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.

GetBackupSelection (updated) Link ¶
Changes (response)
{'BackupSelection': {'Conditions': {'StringEquals': [{'ConditionKey': 'string',
                                                      'ConditionValue': 'string'}],
                                    'StringLike': [{'ConditionKey': 'string',
                                                    'ConditionValue': 'string'}],
                                    'StringNotEquals': [{'ConditionKey': 'string',
                                                         'ConditionValue': 'string'}],
                                    'StringNotLike': [{'ConditionKey': 'string',
                                                       'ConditionValue': 'string'}]},
                     'NotResources': ['string']}}

Returns selection metadata and a document in JSON format that specifies a list of resources that are associated with a backup plan.

See also: AWS API Documentation

Request Syntax

client.get_backup_selection(
    BackupPlanId='string',
    SelectionId='string'
)
type BackupPlanId

string

param BackupPlanId

[REQUIRED]

Uniquely identifies a backup plan.

type SelectionId

string

param SelectionId

[REQUIRED]

Uniquely identifies the body of a request to assign a set of resources to a backup plan.

rtype

dict

returns

Response Syntax

{
    'BackupSelection': {
        'SelectionName': 'string',
        'IamRoleArn': 'string',
        'Resources': [
            'string',
        ],
        'ListOfTags': [
            {
                'ConditionType': 'STRINGEQUALS',
                'ConditionKey': 'string',
                'ConditionValue': 'string'
            },
        ],
        'NotResources': [
            'string',
        ],
        'Conditions': {
            'StringEquals': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringNotEquals': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringLike': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ],
            'StringNotLike': [
                {
                    'ConditionKey': 'string',
                    'ConditionValue': 'string'
                },
            ]
        }
    },
    'SelectionId': 'string',
    'BackupPlanId': 'string',
    'CreationDate': datetime(2015, 1, 1),
    'CreatorRequestId': 'string'
}

Response Structure

  • (dict) --

    • BackupSelection (dict) --

      Specifies the body of a request to assign a set of resources to a backup plan.

      • SelectionName (string) --

        The display name of a resource selection document.

      • IamRoleArn (string) --

        The ARN of the IAM role that Backup uses to authenticate when backing up the target resource; for example, arn:aws:iam::123456789012:role/S3Access .

      • Resources (list) --

        An array of strings that contain Amazon Resource Names (ARNs) of resources to assign to a backup plan.

        • (string) --

      • ListOfTags (list) --

        An array of conditions used to specify a set of resources to assign to a backup plan; for example, "StringEquals": {"ec2:ResourceTag/Department": "accounting" . Assigns the backup plan to every resource with at least one matching tag.

        • (dict) --

          Contains an array of triplets made up of a condition type (such as StringEquals ), a key, and a value. Conditions are used to filter resources in a selection that is assigned to a backup plan.

          • ConditionType (string) --

            An operation, such as StringEquals , that is applied to a key-value pair used to filter resources in a selection.

          • ConditionKey (string) --

            The key in a key-value pair. For example, in "ec2:ResourceTag/Department": "accounting" , "ec2:ResourceTag/Department" is the key.

          • ConditionValue (string) --

            The value in a key-value pair. For example, in "ec2:ResourceTag/Department": "accounting" , "accounting" is the value.

      • NotResources (list) --

        • (string) --

      • Conditions (dict) --

        • StringEquals (list) --

          • (dict) --

            • ConditionKey (string) --

            • ConditionValue (string) --

        • StringNotEquals (list) --

          • (dict) --

            • ConditionKey (string) --

            • ConditionValue (string) --

        • StringLike (list) --

          • (dict) --

            • ConditionKey (string) --

            • ConditionValue (string) --

        • StringNotLike (list) --

          • (dict) --

            • ConditionKey (string) --

            • ConditionValue (string) --

    • SelectionId (string) --

      Uniquely identifies the body of a request to assign a set of resources to a backup plan.

    • BackupPlanId (string) --

      Uniquely identifies a backup plan.

    • CreationDate (datetime) --

      The date and time a backup selection is created, in Unix format and Coordinated Universal Time (UTC). The value of CreationDate is accurate to milliseconds. For example, the value 1516925490.087 represents Friday, January 26, 2018 12:11:30.087 AM.

    • CreatorRequestId (string) --

      A unique string that identifies the request and allows failed requests to be retried without the risk of running the operation twice.