Adds tags to the resources of various Alibaba Cloud services.
Operation description
Tags are used to identify resources. Tags allow you to categorize, search for, and aggregate resources that have the same characteristics from different dimensions. This facilitates resource management. For more information, see Tag overview.
For information about the Alibaba Cloud services that support tags, see Services that work with Tag.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
tag:TagResources | Write |
|
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID.
| cn-hangzhou |
Tags | string | Yes | The key-value pairs of tags. You can specify 1 to 10 key-value pairs. If you specify multiple tags, the system adds all the tags to the specified resources. Limits:
| {"k1":"v1","k2":"v2"} |
ResourceARN | array | Yes | The Alibaba Cloud Resource Name (ARN) of a resource. | |
string | Yes | The ARN of a resource. Valid values of N: 1 to 50. Format:
Note
You can set ProductCode and ResourceType in ResourceARN to values defined in Resource Group, ActionTrail, or Resource Center.
| arn:acs:vpc:cn-hangzhou:123456789****:vpc/vpc-bp19dd90tkt6tz7wu**** |
For more information about common request parameters, see Common parameters.
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "72086426-9F8C-4A60-852B-864048FD1199",
"FailedResources": {
"FailedResource": [
{
"ResourceARN": "arn:acs:vpc:cn-hangzhou:123456789****:vpc/vpc-bp19dd90tkt6tz7wu****",
"Result": {
"Code": "InvalidResourceId.NotFound",
"Message": "The specified ResourceIds are not found in our records."
}
}
]
}
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | InvalidParameter.Tags | The specified value of parameter Tags is not valid. | The specified value of parameter Tags is not valid. |
403 | Duplicate.TagKey | The Tag.N.Key contains duplicate keys. | The Tag.N.Key contains duplicate keys. |
403 | InvalidParameter.Category | The specified Category is invalid. Valid values are Custom and System. | The specified Category is invalid. Valid values are Custom and System. |
403 | MissingParameter.Createby | You must specify Createby. | You must specify Createby. |
403 | MissingParameter.ResourceIds | You must specify ResourceIds. | You must specify ResourceIds. |
403 | NoPermission.Operator | The user is not authorized to operate on the specified resource. | The user is not authorized to operate on the specified resource. |
403 | NoPermissionKey.Category | Some keys cannot be modified because the user does not have permission. | Some keys cannot be modified because the user does not have permission. |
403 | NoPermissionKey.Operator | You are not authorized to operate the tag key. | You are not authorized to operate the tag key. |
403 | NumberExceed.ResourceIds | The maximum number of ResourceIds is exceeded. | The maximum number of ResourceIds is exceeded. |
403 | NumberExceed.Tags | The maximum number of Tags is exceeded. | The maximum number of Tags is exceeded. |
403 | QuotaExceed.TagsPerResource | The maximum number of tags for each resource is exceeded. | The maximum number of tags for each resource is exceeded. |
403 | Invalid.ResourceIdARN | The parameter ResourceIdARN is invalid. | The parameter ResourceIdARN is invalid. |
403 | InvalidParameter.ResourceType | The ResourceType parameter is invalid. | The ResourceType parameter is invalid. |
403 | InvalidParameter.TagKey | The Tag.N.Key parameter is invalid. | The Tag.N.Key parameter is invalid. |
403 | InvalidParameter.TagValue | The Tag.N.Value parameter is invalid. | The Tag.N.Value parameter is invalid. |
404 | Missing.TagKey | Tag.N.Value has been specified and you must specify Tag.N.Key. | Tag.N.Value has been specified and you must specify Tag.N.Key. |
404 | MissingParameter.AliUid | You must specify AliUid. | You must specify AliUid. |
404 | MissingParameter.Bid | You must specify Bid. | You must specify Bid. |
404 | MissingParameter.TagKey | You must specify TagKey. | You must specify TagKey. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
2024-02-27 | The Error code has changed | see changesets | ||||||||
|