ListTagsForResource - Amazon Elastic Container Service
Services or capabilities described in Amazon Web Services documentation might vary by Region. To see the differences applicable to the China Regions, see Getting Started with Amazon Web Services in China (PDF).

ListTagsForResource

List the tags for an Amazon ECS resource.

Request Syntax

{ "resourceArn": "string" }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

resourceArn

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.

Type: String

Required: Yes

Response Syntax

{ "tags": [ { "key": "string", "value": "string" } ] }

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

tags

The tags for the resource.

Type: Array of Tag objects

Array Members: Minimum number of 0 items. Maximum number of 50 items.

Errors

For information about the errors that are common to all actions, see Common Errors.

ClientException

These errors are usually caused by a client action. This client action might be using an action or resource on behalf of a user that doesn't have permissions to use the action or resource. Or, it might be specifying an identifier that isn't valid.

HTTP Status Code: 400

ClusterNotFoundException

The specified cluster wasn't found. You can view your available clusters with ListClusters. Amazon ECS clusters are Region specific.

HTTP Status Code: 400

InvalidParameterException

The specified parameter isn't valid. Review the available parameters for the API request.

HTTP Status Code: 400

ServerException

These errors are usually caused by a server issue.

HTTP Status Code: 500

Examples

In the following example or examples, the Authorization header contents (AUTHPARAMS) must be replaced with an Amazon Signature Version 4 signature. For more information, see Signature Version 4 Signing Process in the Amazon General Reference.

You only need to learn how to sign HTTP requests if you intend to create them manually. When you use the Amazon Command Line Interface or one of the Amazon SDKs to make requests to Amazon, these tools automatically sign the requests for you, with the access key that you specify when you configure the tools. When you use these tools, you don't have to sign requests yourself.

Example

This example lists the tags for the dev cluster.

Sample Request

POST / HTTP/1.1 Host: ecs.us-west-2.amazonaws.com Accept-Encoding: identity X-Amz-Target: AmazonEC2ContainerServiceV20141113.ListTagsForResource Content-Type: application/x-amz-json-1.1 X-Amz-Date: 20181026T195430Z Authorization: AUTHPARAMS Content-Length: 72 { "resourceArn":"arn:aws:ecs:us-west-2:012345678910:cluster/dev" }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 123a4b56-7c89-01d2-3ef4-example5678f Content-Type: application/x-amz-json-1.1 Content-Length: 39 Date: Fri, 26 Oct 2018 19:54:31 GMT { "tags":[ { "key":"team", "value":"dev" } ] }

See Also

For more information about using this API in one of the language-specific Amazon SDKs, see the following: