

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

Adds tags to a Lambda MicroVM resource.

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

```
POST /2017-03-31/tags/{{Resource}} HTTP/1.1
Content-type: application/json

{
   "Tags": { 
      "{{string}}" : "{{string}}" 
   }
}
```

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

The request uses the following URI parameters.

 ** [Resource](#API_TagResource_RequestSyntax) **   <a name="lambdamicrovm-TagResource-request-uri-Resource"></a>
The ARN of the resource to tag.  
Length Constraints: Minimum length of 1. Maximum length of 10000.  
Pattern: `arn:(aws[a-zA-Z-]*):lambda:(eusc-)?[a-z]{2}((-gov)|(-iso([a-z]?)))?-[a-z]+-\d{1}:\d{12}:(function:[a-zA-Z0-9-_]+(:(\$LATEST|[a-zA-Z0-9-_]+))?|layer:([a-zA-Z0-9-_]+)|code-signing-config:csc-[a-z0-9]{17}|event-source-mapping:[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}|(capacity-provider|network-connector|microvm-image):[a-zA-Z0-9-_]+)`   
Required: Yes

## Request Body
<a name="API_TagResource_RequestBody"></a>

The request accepts the following data in JSON format.

 ** [Tags](#API_TagResource_RequestSyntax) **   <a name="lambdamicrovm-TagResource-request-Tags"></a>
The key-value pairs of tags to add to the resource.  
Type: String to string map  
Key Length Constraints: Minimum length of 1. Maximum length of 128.  
Key Pattern: `([\p{L}\p{Z}\p{N}_.:/=+\-@]*)`   
Value Length Constraints: Minimum length of 0. Maximum length of 256.  
Value Pattern: `([\p{L}\p{Z}\p{N}_.:/=+\-@]*)`   
Required: Yes

## Response Syntax
<a name="API_TagResource_ResponseSyntax"></a>

```
HTTP/1.1 204
```

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

If the action is successful, the service sends back an HTTP 204 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).

 ** AccessDeniedException **   
You do not have sufficient access to perform this action.  
HTTP Status Code: 403

 ** InternalServerException **   
An internal server error occurred. Retry the request later.    
 ** retryAfterSeconds **   
The number of seconds to wait before retrying the request.
HTTP Status Code: 500

 ** InvalidParameterValueException **   
One of the parameters in the request is not valid.    
 ** Type **   
The exception type.
HTTP Status Code: 400

 ** ResourceConflictException **   
The resource already exists, or another operation is in progress.    
 ** Type **   
The exception type.
HTTP Status Code: 409

 ** ResourceNotFoundException **   
The specified resource does not exist.    
 ** resourceId **   
The identifier of the resource that was not found.  
 ** resourceType **   
The type of the resource that was not found.
HTTP Status Code: 404

 ** ServiceException **   
The Amazon Lambda MicroVMs service encountered an internal error. Retry your request.    
 ** Type **   
The exception type.
HTTP Status Code: 500

 ** ThrottlingException **   
The request was denied due to request throttling. Retry the request later.    
 ** quotaCode **   
The quota code of the throttled service quota.  
 ** retryAfterSeconds **   
The number of seconds to wait before retrying the request.  
 ** serviceCode **   
The service code of the throttled service quota.
HTTP Status Code: 429

 ** TooManyRequestsException **   
The request throughput limit was exceeded. Retry the request later.    
 ** Type **   
The exception type.
HTTP Status Code: 429

 ** ValidationException **   
The input does not satisfy the constraints specified by the service.  
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 Amazon SDKs, see the following:
+  [Amazon Command Line Interface V2](https://docs.amazonaws.cn/goto/cli2/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for .NET V4](https://docs.amazonaws.cn/goto/DotNetSDKV4/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for C\+\+](https://docs.amazonaws.cn/goto/SdkForCpp/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for Go v2](https://docs.amazonaws.cn/goto/SdkForGoV2/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for Java V2](https://docs.amazonaws.cn/goto/SdkForJavaV2/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for JavaScript V3](https://docs.amazonaws.cn/goto/SdkForJavaScriptV3/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for Kotlin](https://docs.amazonaws.cn/goto/SdkForKotlin/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for PHP V3](https://docs.amazonaws.cn/goto/SdkForPHPV3/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for Python (Boto3)](https://docs.amazonaws.cn/goto/boto3/lambda-microvms-2025-09-09/TagResource) 
+  [Amazon SDK for Ruby V3](https://docs.amazonaws.cn/goto/SdkForRubyV3/lambda-microvms-2025-09-09/TagResource) 