Options
All
  • Public
  • Public/Protected
  • All
Menu

Class TagResourceCommand

Assigns one or more tags (key-value pairs) to the specified CloudWatch resource. Currently, the only CloudWatch resources that can be tagged are alarms and Contributor Insights rules.

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.

Tags don't have any semantic meaning to Amazon Web Services and are interpreted strictly as strings of characters.

You can use the TagResource action with an alarm that already has tags. If you specify a new tag key for the alarm, this tag is appended to the list of tags associated with the alarm. If you specify a tag key that is already associated with the alarm, the new tag value that you specify replaces the previous value for that tag.

You can associate as many as 50 tags with a CloudWatch resource.

example

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

import { CloudWatchClient, TagResourceCommand } from "@aws-sdk/client-cloudwatch"; // ES Modules import
// const { CloudWatchClient, TagResourceCommand } = require("@aws-sdk/client-cloudwatch"); // CommonJS import
const client = new CloudWatchClient(config);
const command = new TagResourceCommand(input);
const response = await client.send(command);
see

TagResourceCommandInput for command's input shape.

see

TagResourceCommandOutput for command's response shape.

see

config for CloudWatchClient's config shape.

Hierarchy

Implements

Index

Constructors

Properties

Constructors

constructor

  • Parameters

    Returns TagResourceCommand

  • Parameters

    • input: TagResourceCommandInput

    Returns TagResourceCommand

Properties

Readonly input

input: TagResourceCommandInput

Readonly middlewareStack

middlewareStack: IMiddlewareStack<TagResourceCommandInput, TagResourceCommandOutput>