- Navigation GuideYou are on a Command (operation) page with structural examples. Use the navigation breadcrumb if you would like to return to the Client landing page.
TagResourceCommand
Assigns one or more tags (key-value pairs) to the specified Amazon Location Service resource.
Tags can help you organize and categorize your resources. You can also use them to scope user permissions, by granting a user permission to access or change only resources with certain tag values.
You can use the TagResource
operation with an Amazon Location Service resource that already has tags. If you specify a new tag key for the resource, this tag is appended to the tags already associated with the resource. If you specify a tag key that's already associated with the resource, the new tag value that you specify replaces the previous value for that tag.
You can associate up to 50 tags with a resource.
Example Syntax
Use a bare-bones client and the command you need to make an API call.
import { LocationClient, TagResourceCommand } from "@aws-sdk/client-location"; // ES Modules import
// const { LocationClient, TagResourceCommand } = require("@aws-sdk/client-location"); // CommonJS import
const client = new LocationClient(config);
const input = { // TagResourceRequest
ResourceArn: "STRING_VALUE", // required
Tags: { // TagMap // required
"<keys>": "STRING_VALUE",
},
};
const command = new TagResourceCommand(input);
const response = await client.send(command);
// {};
TagResourceCommand Input
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
ResourceArn Required | string | undefined | The Amazon Resource Name (ARN) of the resource whose tags you want to update.
|
Tags Required | Record<string, string> | undefined | Applies one or more tags to specific resource. A tag is a key-value pair that helps you manage, identify, search, and filter your resources. Format: Restrictions:
|
TagResourceCommand Output
Parameter | Type | Description |
---|
Parameter | Type | Description |
---|---|---|
$metadata Required | ResponseMetadata | Metadata pertaining to this request. |
Throws
Name | Fault | Details |
---|
Name | Fault | Details |
---|---|---|
AccessDeniedException | client | The request was denied because of insufficient access or permissions. Check with an administrator to verify your permissions. |
InternalServerException | server | The request has failed to process because of an unknown server error, exception, or failure. |
ResourceNotFoundException | client | The resource that you've entered was not found in your AWS account. |
ThrottlingException | client | The request was denied because of request throttling. |
ValidationException | client | The input failed to meet the constraints specified by the AWS service. |
LocationServiceException | Base exception class for all service exceptions from Location service. |