Menu
Amazon Elastic MapReduce
API Reference (API Version 2009-03-31)

AddTags

Adds tags to an Amazon EMR resource. Tags make it easier to associate clusters 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. This value must be a cluster identifier.

Type: String

Required: Yes

Tags

A list of tags to associate with a cluster and propagate to EC2 instances. 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 EMR service.

HTTP Status Code: 500

InvalidRequestException

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

HTTP Status Code: 400

Example

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: