AddTags - Amazon EMR

AddTags

Adds tags to an Amazon EMR resource, such as a cluster or an Amazon EMR Studio. Tags make it easier to associate resources in various ways, such as grouping clusters to track your Amazon EMR resource allocation costs. For more information, see Tag Clusters.

Request Syntax

{ "ResourceId": "string", "Tags": [ { "Key": "string", "Value": "string" } ] }

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

ResourceId

The Amazon EMR resource identifier to which tags will be added. For example, a cluster identifier or an Amazon EMR Studio ID.

Type: String

Required: Yes

Tags

A list of tags to associate with a resource. Tags are user-defined key-value pairs that consist of a required key string with a maximum of 128 characters, and an optional value string with a maximum of 256 characters.

Type: Array of Tag objects

Required: Yes

Response Elements

If the action is successful, the service sends back an HTTP 200 response with an empty HTTP body.

Errors

For information about the errors that are common to all actions, see Common Errors.

InternalServerException

This exception occurs when there is an internal failure in the Amazon EMR service.

HTTP Status Code: 500

InvalidRequestException

This exception occurs when there is something wrong with user input.

HTTP Status Code: 400

Examples

Example

This example illustrates one usage of AddTags.

Sample Request

POST / HTTP/1.1 Content-Type: application/x-amz-json-1.1 X-Amz-Target: ElasticMapReduce.AddTags AUTHPARAMS { "ResourceId": "j-3U7TSX5GZFD8Y", "Tags": [{ "Key": "stack", "Value": "Production" }, { "Key": "hbase" }] }

Sample Response

HTTP/1.1 200 OK x-amzn-RequestId: 9da5a349-ed9e-11e2-90db-69a5154aeb8d Content-Type: application/x-amz-json-1.1 Content-Length: 71 Date: Mon, 15 Jul 2013 22:33:47 GMT { }

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: