Adds tags to a customer master key (CMK) or secret.

A CMK or secret can have multiple tags. Each tag is defined by a pair of tag key and tag value. You can add up to 10 tags to a CMK or secret.

Request format: KeyId="string"&Tags=[{ "TagKey": "string","TagValue": "string"} ]

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes TagResource

The operation that you want to perform. Set the value to TagResource.

Tags String Yes [{\"TagKey\":\"S1key1\",\"TagValue\":\"S1val1\"},{\"TagKey\":\"S1key2\",\"TagValue\":\"S2val2\"}]

One or more tags.

Format: tag object array. Tag object attributes:

  • TagKey: tag key
  • TagValue: tag value
KeyId String No 08c33a6f-4e0a-4a1b-a3fa-7ddfa1d4

The globally unique identifier of the key of the CMK to which you want to add tags.

Note Set either KeyId or SecretName.
SecretName String No MyDbCreds

The name of the secret to which you want to add tags.

Note Set either KeyId or SecretName.

Response parameters

Parameter Type Example Description
RequestId String 4162a6af-bc99-40b3-a552-89dcc8aaf7c8

The ID of the request.

Examples

Sample request

http(s)://[Endpoint]/?Action=TagResource
&KeyId=08c33a6f-4e0a-4a1b-a3fa-7ddfa1d4
&Tags=[{\"TagKey\":\"S1key1\",\"TagValue\":\"S1val1\"},{\"TagKey\":\"S1key2\",\"TagValue\":\"S2val2\"}]
&<Common request parameters>

Sample success responses

XML format

<KMS>
    <RequestId>4162a6af-bc99-40b3-a552-89dcc8aaf7c8</RequestId>
</KMS>

JSON format

{
    "RequestId": "4162a6af-bc99-40b3-a552-89dcc8aaf7c8"
}

Error codes

For a list of error codes, visit the API Error Center.