ElasticLoadBalancing / Client / add_tags

add_tags#

ElasticLoadBalancing.Client.add_tags(**kwargs)#

Adds the specified tags to the specified load balancer. Each load balancer can have a maximum of 10 tags.

Each tag consists of a key and an optional value. If a tag with the same key is already associated with the load balancer, AddTags updates its value.

For more information, see Tag Your Classic Load Balancer in the Classic Load Balancers Guide.

See also: AWS API Documentation

Request Syntax

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

    [REQUIRED]

    The name of the load balancer. You can specify one load balancer only.

    • (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) –

    Contains the output of AddTags.

Exceptions

  • ElasticLoadBalancing.Client.exceptions.AccessPointNotFoundException

  • ElasticLoadBalancing.Client.exceptions.TooManyTagsException

  • ElasticLoadBalancing.Client.exceptions.DuplicateTagKeysException

Examples

This example adds two tags to the specified load balancer.

response = client.add_tags(
    LoadBalancerNames=[
        'my-load-balancer',
    ],
    Tags=[
        {
            'Key': 'project',
            'Value': 'lima',
        },
        {
            'Key': 'department',
            'Value': 'digital-media',
        },
    ],
)

print(response)

Expected Output:

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