Creates tags and adds them to a virtual private cloud (VPC) peering connection.
Operation description
Tags are used to classify instances. Each tag consists of a key-value pair. Before you use tags, take note of the following limits:
-
The keys of tags that are added to the same instance must be unique.
-
You cannot create tags without adding them to instances. All tags must be added to instances.
-
Tag information is not shared across regions.
For example, you cannot view the tags that are created in the China (Hangzhou) region from the China (Shanghai) region.
-
For the same account and region, tags added to different VPC peering connections are shared.
For example, if a tag is added to a VPC peering connection, the tag can also be added to other VPC peering connections within the same account and region. You can modify the key and the value of a tag or remove a tag from an instance. After you delete an instance, all tags that are added to the instance are deleted.
-
You can add up to 20 tags to each instance. Before you add a tag to an instance, the system automatically checks the number of existing tags. An error message is returned if the maximum number of tags is reached.
Debugging
Authorization information
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
ResourceId | array | Yes | The IDs of resources. | |
string | Yes | The ID of the resource. You can specify at most 20 IDs. | pcc-bp16qjewdsunr41m1**** | |
Tag | object [] | Yes | The tags. | |
Key | string | No | The tag key. You must specify at least one tag key and at most 20 tag keys. The tag key cannot be an empty string. The tag key can be up to 128 characters in length. It cannot start with | FinanceDept |
Value | string | No | The tag value. You must specify at least one tag value and can specify at most 20 tag values. The tag value can be an empty string. The tag value can be up to 128 characters in length. It cannot start with | FinanceJoshua |
ResourceType | string | Yes | The type of the resource. Set the value to PeerConnection, which specifies a VPC peering connection. | PeerConnection |
ClientToken | string | No | The client token that is used to ensure the idempotence of the request. You can use the client to generate the token, but you must make sure that the token is unique among all requests. The token can contain only ASCII characters. Note
If you do not specify this parameter, ClientToken is set to the value of RequestId. The value of RequestId for each API request may be different.
| 123e4567-e89b-12d3-a456-426655440000 |
RegionId | string | Yes | The region ID of the resource to which you want to create and add tags. You can call the DescribeRegions operation to query the most recent region list. | cn-hangzhou |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "C46FF5A8-C5F0-4024-8262-B16B639225A0",
"Success": true
}
Error codes
HTTP status code | Error code | Error message | Description |
---|---|---|---|
400 | NumberExceed.Tags | The maximum number of tags is exceeded. | The number of tags has reached the upper limit. |
400 | NumberExceed.ResourceIds | The maximum number of resource IDs is exceeded. | The number of resource group IDs exceeds the upper limit. |
400 | Forbidden.TagKeys | The tag key cannot be operated by the request. | You cannot manage the tag key by calling the operation. |
400 | Forbidden.TagKey.Duplicated | The specified tag key already exists. | The tag resources are duplicate. |
400 | InvalidInstanceIds.NotFound | The instance IDs are not found. | The instance ID is invalid. |
400 | InvalidInstanceType.NotFound | The instance type is not found. | The instance type is invalid. |
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation | ||||||
---|---|---|---|---|---|---|---|---|
2023-12-08 | API Description Update. The Error code has changed | see changesets | ||||||
|