ElasticLoadBalancingv2 / Client / describe_tags

describe_tags#

ElasticLoadBalancingv2.Client.describe_tags(**kwargs)#

Describes the tags for the specified Elastic Load Balancing resources. You can describe the tags for one or more Application Load Balancers, Network Load Balancers, Gateway Load Balancers, target groups, listeners, or rules.

See also: AWS API Documentation

Request Syntax

response = client.describe_tags(
    ResourceArns=[
        'string',
    ]
)
Parameters:

ResourceArns (list) –

[REQUIRED]

The Amazon Resource Names (ARN) of the resources. You can specify up to 20 resources in a single call.

  • (string) –

Return type:

dict

Returns:

Response Syntax

{
    'TagDescriptions': [
        {
            'ResourceArn': 'string',
            'Tags': [
                {
                    'Key': 'string',
                    'Value': 'string'
                },
            ]
        },
    ]
}

Response Structure

  • (dict) –

    • TagDescriptions (list) –

      Information about the tags.

      • (dict) –

        The tags associated with a resource.

        • ResourceArn (string) –

          The Amazon Resource Name (ARN) of the resource.

        • Tags (list) –

          Information about the tags.

          • (dict) –

            Information about a tag.

            • Key (string) –

              The key of the tag.

            • Value (string) –

              The value of the tag.

Exceptions

  • ElasticLoadBalancingv2.Client.exceptions.LoadBalancerNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.TargetGroupNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.ListenerNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.RuleNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.TrustStoreNotFoundException

Examples

This example describes the tags assigned to the specified load balancer.

response = client.describe_tags(
    ResourceArns=[
        'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188',
    ],
)

print(response)

Expected Output:

{
    'TagDescriptions': [
        {
            'ResourceArn': 'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188',
            'Tags': [
                {
                    'Key': 'project',
                    'Value': 'lima',
                },
                {
                    'Key': 'department',
                    'Value': 'digital-media',
                },
            ],
        },
    ],
    'ResponseMetadata': {
        '...': '...',
    },
}