Adds one or more tags to a trail, event data store, or channel, up to a limit of 50. Overwrites an existing tag's value when a new value is specified for an existing tag key. Tag key names must be unique; you cannot have two keys with the same name but different values. If you specify a key without a value, the tag will be created with the specified key and a value of null. You can tag a trail or event data store that applies to all Amazon Web Services Regions only from the Region in which the trail or event data store was created (also known as its home region).

See also: AWS API Documentation

Request Syntax

response = client.add_tags(
            'Key': 'string',
            'Value': 'string'
  • ResourceId (string) --


    Specifies the ARN of the trail, event data store, or channel to which one or more tags will be added.

    The format of a trail ARN is: arn:aws:cloudtrail:us-east-2:123456789012:trail/MyTrail

    The format of an event data store ARN is: arn:aws:cloudtrail:us-east-2:12345678910:eventdatastore/EXAMPLE-f852-4e8f-8bd1-bcf6cEXAMPLE

    The format of a channel ARN is: arn:aws:cloudtrail:us-east-2:123456789012:channel/01234567890

  • TagsList (list) --


    Contains a list of tags, up to a limit of 50

    • (dict) --

      A custom key-value pair associated with a resource such as a CloudTrail trail, event data store, or channel.

      • Key (string) -- [REQUIRED]

        The key in a key-value pair. The key must be must be no longer than 128 Unicode characters. The key must be unique for the resource to which it applies.

      • Value (string) --

        The value in a key-value pair of a tag. The value must be no longer than 256 Unicode characters.

Return type



Response Syntax


Response Structure

  • (dict) --

    Returns the objects or data if successful. Otherwise, returns an error.


  • CloudTrail.Client.exceptions.ResourceNotFoundException
  • CloudTrail.Client.exceptions.CloudTrailARNInvalidException
  • CloudTrail.Client.exceptions.ResourceTypeNotSupportedException
  • CloudTrail.Client.exceptions.TagsLimitExceededException
  • CloudTrail.Client.exceptions.InvalidTrailNameException
  • CloudTrail.Client.exceptions.InvalidTagParameterException
  • CloudTrail.Client.exceptions.InactiveEventDataStoreException
  • CloudTrail.Client.exceptions.EventDataStoreNotFoundException
  • CloudTrail.Client.exceptions.ChannelNotFoundException
  • CloudTrail.Client.exceptions.UnsupportedOperationException
  • CloudTrail.Client.exceptions.OperationNotPermittedException
  • CloudTrail.Client.exceptions.NotOrganizationMasterAccountException
  • CloudTrail.Client.exceptions.NoManagementAccountSLRExistsException
  • CloudTrail.Client.exceptions.ConflictException