DatabaseMigrationService / Client / add_tags_to_resource

add_tags_to_resource#

DatabaseMigrationService.Client.add_tags_to_resource(**kwargs)#

Adds metadata tags to an DMS resource, including replication instance, endpoint, subnet group, and migration task. These tags can also be used with cost allocation reporting to track cost associated with DMS resources, or used in a Condition statement in an IAM policy for DMS. For more information, see Tag data type description.

See also: AWS API Documentation

Request Syntax

response = client.add_tags_to_resource(
    ResourceArn='string',
    Tags=[
        {
            'Key': 'string',
            'Value': 'string',
            'ResourceArn': 'string'
        },
    ]
)
Parameters:
  • ResourceArn (string) –

    [REQUIRED]

    Identifies the DMS resource to which tags should be added. The value for this parameter is an Amazon Resource Name (ARN).

    For DMS, you can tag a replication instance, an endpoint, or a replication task.

  • Tags (list) –

    [REQUIRED]

    One or more tags to be assigned to the resource.

    • (dict) –

      A user-defined key-value pair that describes metadata added to an DMS resource and that is used by operations such as the following:

      • AddTagsToResource

      • ListTagsForResource

      • RemoveTagsFromResource

      • Key (string) –

        A key is the required name of the tag. The string value can be 1-128 Unicode characters in length and can’t be prefixed with “aws:” or “dms:”. The string can only contain only the set of Unicode letters, digits, white-space, ‘_’, ‘.’, ‘/’, ‘=’, ‘+’, ‘-’ (Java regular expressions: “^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$”).

      • Value (string) –

        A value is the optional value of the tag. The string value can be 1-256 Unicode characters in length and can’t be prefixed with “aws:” or “dms:”. The string can only contain only the set of Unicode letters, digits, white-space, ‘_’, ‘.’, ‘/’, ‘=’, ‘+’, ‘-’ (Java regular expressions: “^([\p{L}\p{Z}\p{N}_.:/=+\-]*)$”).

      • ResourceArn (string) –

        The Amazon Resource Name (ARN) string that uniquely identifies the resource for which the tag is created.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • DatabaseMigrationService.Client.exceptions.ResourceNotFoundFault

Examples

Adds metadata tags to an AWS DMS resource, including replication instance, endpoint, security group, and migration task. These tags can also be used with cost allocation reporting to track cost associated with AWS DMS resources, or used in a Condition statement in an IAM policy for AWS DMS.

response = client.add_tags_to_resource(
    # Required. Use the ARN of the resource you want to tag.
    ResourceArn='arn:aws:dms:us-east-1:123456789012:endpoint:ASXWXJZLNWNT5HTWCGV2BUJQ7E',
    # Required. Use the Key/Value pair format.
    Tags=[
        {
            'Key': 'Acount',
            'Value': '1633456',
        },
    ],
)

print(response)

Expected Output:

{
    'ResponseMetadata': {
        '...': '...',
    },
}