TagResource
Adds a tag to a resource.
Request Syntax
POST /tags/resourceArn HTTP/1.1
Content-type: application/json
{
"tags": {
"string" : "string"
}
}
URI Request Parameters
The request uses the following URI parameters.
- resourceArn
-
The Amazon Resource Name (ARN) of the resource that you want to tag.
Pattern:
^arn:aws[^:]*:imagebuilder:[^:]+:(?:[0-9]{12}|aws(?:-[a-z-]+)?|third-party):(?:image-recipe|container-recipe|infrastructure-configuration|distribution-configuration|component|image|image-pipeline|lifecycle-policy|workflow\/(?:build|test|distribution))/[a-z0-9-_]+(?:/(?:(?:x|[0-9]+)\.(?:x|[0-9]+)\.(?:x|[0-9]+))(?:/[0-9]+)?)?$Required: Yes
Request Body
The request accepts the following data in JSON format.
-
The tags to apply to the resource.
Type: String to string map
Map Entries: Maximum number of 50 items.
Key Length Constraints: Minimum length of 1. Maximum length of 128.
Key Pattern:
^(?!aws:)[a-zA-Z0-9\s_.:/=+\-@]*$Value Length Constraints: Maximum length of 256.
Required: Yes
Response Syntax
HTTP/1.1 200
Response Elements
If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.
Errors
For information about the errors that are common to all actions, see Common Error Types.
- InvalidParameterException
-
The specified parameter is invalid. Review the available parameters for the API request.
HTTP Status Code: 400
- ResourceNotFoundException
-
At least one of the resources referenced by your request does not exist.
HTTP Status Code: 404
- ServiceException
-
An internal server error occurred while Image Builder processed the request. Retrying the request may succeed.
HTTP Status Code: 500
Examples
Add tags to a component build version
The following example adds two tags to a component build version.
Sample Request
POST /tags/arn%3Aaws%3Aimagebuilder%3Aus-west-2%3A111122223333%3Acomponent%2Fmy-example-tagged-component%2F1.0.0%2F1 HTTP/1.1
Content-type: application/json
{
"tags": {
"Environment": "Production",
"CostCenter": "12345"
}
}
Sample Response
HTTP/1.1 200
See Also
For more information about using this API in one of the language-specific AWS SDKs, see the following: