List the tags for an Amazon ECS resource.
See also: AWS API Documentation
Request Syntax
response = client.list_tags_for_resource(
resourceArn='string'
)
[REQUIRED]
The Amazon Resource Name (ARN) that identifies the resource to list the tags for. Currently, the supported resources are Amazon ECS tasks, services, task definitions, clusters, and container instances.
{
'tags': [
{
'key': 'string',
'value': 'string'
},
]
}
Response Structure
The tags for the resource.
The metadata that you apply to a resource to help you categorize and organize them. Each tag consists of a key and an optional value. You define them.
The following basic restrictions apply to tags:
aws:
, AWS:
, or any upper or lowercase combination of such as a prefix for either keys or values as it is reserved for Amazon Web Services use. You cannot edit or delete tag keys or values with this prefix. Tags with this prefix do not count against your tags per resource limit.One part of a key-value pair that make up a tag. A key
is a general label that acts like a category for more specific tag values.
The optional part of a key-value pair that make up a tag. A value
acts as a descriptor within a tag category (key).
Exceptions
ECS.Client.exceptions.ServerException
ECS.Client.exceptions.ClientException
ECS.Client.exceptions.ClusterNotFoundException
ECS.Client.exceptions.InvalidParameterException
Examples
This example lists the tags for the 'dev' cluster.
response = client.list_tags_for_resource(
resourceArn='arn:aws:ecs:region:aws_account_id:cluster/dev',
)
print(response)
Expected Output:
{
'tags': [
{
'key': 'team',
'value': 'dev',
},
],
'ResponseMetadata': {
'...': '...',
},
}