TagResourceCommand

Applies one or more tags to a resource.

Example Syntax

Use a bare-bones client and the command you need to make an API call.

import { ResiliencehubClient, TagResourceCommand } from "@aws-sdk/client-resiliencehub"; // ES Modules import
// const { ResiliencehubClient, TagResourceCommand } = require("@aws-sdk/client-resiliencehub"); // CommonJS import
const client = new ResiliencehubClient(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

See TagResourceCommandInput for more details

Parameter
Type
Description
resourceArn
Required
string | undefined

Amazon Resource Name (ARN) of the resource.

tags
Required
Record<string, string> | undefined

The tags to assign to the resource. Each tag consists of a key/value pair.

TagResourceCommand Output

See TagResourceCommandOutput for details

Parameter
Type
Description
$metadata
Required
ResponseMetadata
Metadata pertaining to this request.

Throws

Name
Fault
Details
AccessDeniedException
client

You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.

InternalServerException
server

This exception occurs when there is an internal failure in the Resilience Hub service.

ResourceNotFoundException
client

This exception occurs when the specified resource could not be found.

ThrottlingException
client

This exception occurs when you have exceeded the limit on the number of requests per second.

ValidationException
client

This exception occurs when a request is not valid.

ResiliencehubServiceException
Base exception class for all service exceptions from Resiliencehub service.