ListTagsForResource
Lists the tags that you associated with the specified resource.
Request Syntax
GET /tags/ResourceArn
HTTP/1.1
URI Request Parameters
The request uses the following URI parameters.
- ResourceArn
-
The Amazon Resource Name (ARN) for the resource that you want to list the tags for.
Length Constraints: Minimum length of 1. Maximum length of 255.
Required: Yes
Request Body
The request does not have a request body.
Response Syntax
HTTP/1.1 200
Content-type: application/json
{
"Tags": {
"string" : "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 that are associated with the resource that you specified in the
ListTagsForResource
request.Type: String to string map
Map Entries: Minimum number of 0 items. Maximum number of 200 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Value Length Constraints: Minimum length of 0. Maximum length of 256.
Errors
For information about the errors that are common to all actions, see Common Errors.
- AccessDeniedException
-
The current account doesn't have the IAM permissions required to perform the specified operation.
HTTP Status Code: 400
- ConflictException
-
The request you submitted conflicts with an existing request.
HTTP Status Code: 400
- ResourceNotFoundException
-
The resource you are associating is not found.
HTTP Status Code: 400
- ThrottlingException
-
The request was throttled. Try again in a few minutes.
HTTP Status Code: 400
- ValidationException
-
You have provided an invalid command.
HTTP Status Code: 400
Examples
ListTagsForResource Example
This example illustrates one usage of ListTagsForResource.
Sample Request
GET /tags/arn%3Aaws%3Aroute53profiles%3Aus-east-1%3A123456789012%3Aprofile%2Frp-4987774726example HTTP/1.1
host:route53profiles.us-east-1.amazonaws.com
Accept-Encoding: identity
X-Amz-Date:20240319T232315Z
User-Agent: aws-cli/1.32.63 botocore/1.34.63 Python/3.8.18
Authorization: AWS4-HMAC-SHA256
Credential=AKIAJJ2SONIPEXAMPLE/20181101/us-east-1/route53profiles/aws4_request,
SignedHeaders=host;x-amz-date;x-amz-security-token,
Signature=[calculated-signature]
{} # Request body is empty
Sample Response
HTTP/1.1 200 OK
Date: Tue, 19 Mar 2024 23:23:20 GMT
Content-Type: application/json
Content-Length: 35
Connection: keep-alive
x-amzn-RequestId: dcd9d91e-1a5a-481f-82b7-bafe7dexample
Access-Control-Allow-Origin: *
x-amz-apigw-id: U5eX0FdmIexample=
Access-Control-Expose-Headers: x-amzn-ErrorType, x-amzn-RequestId, x-amzn-ErrorMessage, x-amzn-Trace-Id, x-amz-apigw-id, Date
X-Amzn-Trace-Id: Root=1-65fa10fe-6e5a93a56a325ab8example
{
"Tags": {
"my-key-2": "my-value-2",
"my-key-1": "my-value-1"
}
}
See Also
For more information about using this API in one of the language-specific Amazon SDKs, see the following: