

# TagResource
<a name="API_TagResource"></a>

 Associates the list of tags in the input `Tags` parameter with the resource identified by the `ResourceArn` input parameter. 

## Request Syntax
<a name="API_TagResource_RequestSyntax"></a>

```
{
   "ResourceArn": "string",
   "Tags": [ 
      { 
         "Key": "string",
         "Value": "string"
      }
   ]
}
```

## Request Parameters
<a name="API_TagResource_RequestParameters"></a>

For information about the parameters that are common to all actions, see [Common Parameters](CommonParameters.md).

The request accepts the following data in JSON format.

 ** [ResourceArn](#API_TagResource_RequestSyntax) **   <a name="CodeDeploy-TagResource-request-ResourceArn"></a>
 The ARN of a resource, such as a CodeDeploy application or deployment group.   
Type: String  
Length Constraints: Minimum length of 1. Maximum length of 1011.  
Required: Yes

 ** [Tags](#API_TagResource_RequestSyntax) **   <a name="CodeDeploy-TagResource-request-Tags"></a>
 A list of tags that `TagResource` associates with a resource. The resource is identified by the `ResourceArn` input parameter.   
Type: Array of [Tag](API_Tag.md) objects  
Required: Yes

## Response Elements
<a name="API_TagResource_ResponseElements"></a>

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

## Errors
<a name="API_TagResource_Errors"></a>

For information about the errors that are common to all actions, see [Common Error Types](CommonErrors.md).

 ** ApplicationDoesNotExistException **   
The application does not exist with the user or AWS account.  
HTTP Status Code: 400

 ** ArnNotSupportedException **   
 The specified ARN is not supported. For example, it might be an ARN for a resource that is not expected.   
HTTP Status Code: 400

 ** DeploymentConfigDoesNotExistException **   
The deployment configuration does not exist with the user or AWS account.  
HTTP Status Code: 400

 ** DeploymentGroupDoesNotExistException **   
The named deployment group with the user or AWS account does not exist.  
HTTP Status Code: 400

 ** InvalidArnException **   
 The specified ARN is not in a valid format.   
HTTP Status Code: 400

 ** InvalidTagsToAddException **   
 The specified tags are not valid.   
HTTP Status Code: 400

 ** ResourceArnRequiredException **   
 The ARN of a resource is required, but was not found.   
HTTP Status Code: 400

 ** TagRequiredException **   
A tag was not specified.  
HTTP Status Code: 400

## See Also
<a name="API_TagResource_SeeAlso"></a>

For more information about using this API in one of the language-specific AWS SDKs, see the following:
+  [AWS Command Line Interface V2](https://docs.aws.amazon.com/goto/cli2/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for .NET V4](https://docs.aws.amazon.com/goto/DotNetSDKV4/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for C\$1\$1](https://docs.aws.amazon.com/goto/SdkForCpp/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for Go v2](https://docs.aws.amazon.com/goto/SdkForGoV2/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for Java V2](https://docs.aws.amazon.com/goto/SdkForJavaV2/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for JavaScript V3](https://docs.aws.amazon.com/goto/SdkForJavaScriptV3/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for Kotlin](https://docs.aws.amazon.com/goto/SdkForKotlin/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for PHP V3](https://docs.aws.amazon.com/goto/SdkForPHPV3/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for Python](https://docs.aws.amazon.com/goto/boto3/codedeploy-2014-10-06/TagResource) 
+  [AWS SDK for Ruby V3](https://docs.aws.amazon.com/goto/SdkForRubyV3/codedeploy-2014-10-06/TagResource) 