TagResourceCommand

Adds the specified tags to the specified resource.

Example Syntax

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

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

The Amazon Resource Name (ARN) of the resource.

tags
Required
Record<string, string> | undefined

One or more tags. For example, { "tags": {"key1":"value1", "key2":"value2"} }.

TagResourceCommand Output

See TagResourceCommandOutput for details

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

Throws

Name
Fault
Details
InternalServerException
server

An unexpected error occurred.

ResourceNotFoundException
client

The specified resource was not found.

ServiceQuotaExceededException
client

A service quota has been exceeded.

ValidationException
client

One of the input parameters is not valid.

SavingsplansServiceException
Base exception class for all service exceptions from Savingsplans service.