Skip to main content

tags

Creates, updates, deletes, gets or lists a tags resource.

Overview​

Nametags
TypeResource
Idaws.cloudtrail.tags

Fields​

The following fields are returned by SELECT queries:

NameDatatypeDescription
resource_idstringSpecifies the ARN of the resource.
tags_listarrayA list of tags.

Methods​

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
list_tagsselectregionLists the tags for the specified trails, event data stores, dashboards, or channels in the current Region.
add_tagsupdateregion, ResourceId, TagsListAdds one or more tags to a trail, event data store, dashboard, 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).
remove_tagsexecregion, ResourceId, TagsListRemoves the specified tags from a trail, event data store, dashboard, or channel.

Parameters​

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
regionstringAWS region (default: us-east-1)

SELECT examples​

Lists the tags for the specified trails, event data stores, dashboards, or channels in the current Region.

SELECT
resource_id,
tags_list
FROM aws.cloudtrail.tags
WHERE region = '{{ region }}' -- required
;

UPDATE examples​

Adds one or more tags to a trail, event data store, dashboard, 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).

UPDATE aws.cloudtrail.tags
SET
ResourceId = '{{ ResourceId }}',
TagsList = '{{ TagsList }}'
WHERE
region = '{{ region }}' --required
AND ResourceId = '{{ ResourceId }}' --required
AND TagsList = '{{ TagsList }}' --required;

Lifecycle Methods​

Removes the specified tags from a trail, event data store, dashboard, or channel.

EXEC aws.cloudtrail.tags.remove_tags
@region='{{ region }}' --required
@@json=
'{
"ResourceId": "{{ ResourceId }}",
"TagsList": "{{ TagsList }}"
}'
;