ElasticLoadBalancingv2 / Client / add_tags

add_tags#

ElasticLoadBalancingv2.Client.add_tags(**kwargs)#

Adds the specified tags to the specified Elastic Load Balancing resource. You can tag your Application Load Balancers, Network Load Balancers, Gateway Load Balancers, target groups, trust stores, listeners, and rules.

Each tag consists of a key and an optional value. If a resource already has a tag with the same key, AddTags updates its value.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The Amazon Resource Name (ARN) of the resource.

    • (string) –

  • Tags (list) –

    [REQUIRED]

    The tags.

    • (dict) –

      Information about a tag.

      • Key (string) – [REQUIRED]

        The key of the tag.

      • Value (string) –

        The value of the tag.

Return type:

dict

Returns:

Response Syntax

{}

Response Structure

  • (dict) –

Exceptions

  • ElasticLoadBalancingv2.Client.exceptions.DuplicateTagKeysException

  • ElasticLoadBalancingv2.Client.exceptions.TooManyTagsException

  • ElasticLoadBalancingv2.Client.exceptions.LoadBalancerNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.TargetGroupNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.ListenerNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.RuleNotFoundException

  • ElasticLoadBalancingv2.Client.exceptions.TrustStoreNotFoundException

Examples

This example adds the specified tags to the specified load balancer.

response = client.add_tags(
    ResourceArns=[
        'arn:aws:elasticloadbalancing:us-west-2:123456789012:loadbalancer/app/my-load-balancer/50dc6c495c0c9188',
    ],
    Tags=[
        {
            'Key': 'project',
            'Value': 'lima',
        },
        {
            'Key': 'department',
            'Value': 'digital-media',
        },
    ],
)

print(response)

Expected Output:

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