CreateTagsCommand

Adds tags to a cluster.

A resource can have up to 50 tags. If you try to create more than 50 tags for a resource, you will receive an error and the attempt will fail.

If you specify a key that already exists for the resource, the value for that key will be updated with the new value.

Example Syntax

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

import { RedshiftClient, CreateTagsCommand } from "@aws-sdk/client-redshift"; // ES Modules import
// const { RedshiftClient, CreateTagsCommand } = require("@aws-sdk/client-redshift"); // CommonJS import
const client = new RedshiftClient(config);
const input = { // CreateTagsMessage
  ResourceName: "STRING_VALUE", // required
  Tags: [ // TagList // required
    { // Tag
      Key: "STRING_VALUE",
      Value: "STRING_VALUE",
    },
  ],
};
const command = new CreateTagsCommand(input);
const response = await client.send(command);
// {};

CreateTagsCommand Input

See CreateTagsCommandInput for more details

Parameter
Type
Description
ResourceName
Required
string | undefined

The Amazon Resource Name (ARN) to which you want to add the tag or tags. For example, arn:aws:redshift:us-east-2:123456789:cluster:t1.

Tags
Required
Tag[] | undefined

One or more name/value pairs to add as tags to the specified resource. Each tag name is passed in with the parameter Key and the corresponding value is passed in with the parameter Value. The Key and Value parameters are separated by a comma (,). Separate multiple tags with a space. For example, --tags "Key"="owner","Value"="admin" "Key"="environment","Value"="test" "Key"="version","Value"="1.0".

CreateTagsCommand Output

See CreateTagsCommandOutput for details

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

Throws

Name
Fault
Details
InvalidClusterStateFault
client

The specified cluster is not in the available state.

InvalidTagFault
client

The tag is invalid.

ResourceNotFoundFault
client

The resource could not be found.

TagLimitExceededFault
client

You have exceeded the number of tags allowed.

RedshiftServiceException
Base exception class for all service exceptions from Redshift service.