TagResourceCommand

An API operation for adding one or more tags (key-value pairs) to a resource.

Example Syntax

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

import { BillingClient, TagResourceCommand } from "@aws-sdk/client-billing"; // ES Modules import
// const { BillingClient, TagResourceCommand } = require("@aws-sdk/client-billing"); // CommonJS import
const client = new BillingClient(config);
const input = { // TagResourceRequest
  resourceArn: "STRING_VALUE", // required
  resourceTags: [ // ResourceTagList // required
    { // ResourceTag
      key: "STRING_VALUE", // required
      value: "STRING_VALUE",
    },
  ],
};
const command = new TagResourceCommand(input);
const response = await client.send(command);
// {};

Example Usage

 There was an error loading the code editor. Retry

TagResourceCommand Input

See TagResourceCommandInput for more details

Parameter
Type
Description
resourceArn
Required
string | undefined

The Amazon Resource Name (ARN) of the resource.

resourceTags
Required
ResourceTag[] | undefined

A list of tag key value pairs that are associated with the resource.

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 sufficient access to perform this action.

InternalServerException
server

The request processing failed because of an unknown error, exception, or failure.

ResourceNotFoundException
client

The specified ARN in the request doesn't exist.

ThrottlingException
client

The request was denied due to request throttling.

ValidationException
client

The input fails to satisfy the constraints specified by an Amazon Web Services service.

BillingServiceException
Base exception class for all service exceptions from Billing service.