All Products
Search
Document Center

Virtual Private Cloud:TagResources

Last Updated:Mar 19, 2024

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

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
ResourceIdarrayYes

The IDs of resources.

stringYes

The ID of the resource. You can specify at most 20 IDs.

pcc-bp16qjewdsunr41m1****
Tagobject []Yes

The tags.

KeystringNo

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 acs: or aliyun and cannot contain http:// or https://.

FinanceDept
ValuestringNo

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 aliyun or acs:, and cannot contain http:// or https://.

FinanceJoshua
ResourceTypestringYes

The type of the resource. Set the value to PeerConnection, which specifies a VPC peering connection.

PeerConnection
ClientTokenstringNo

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
RegionIdstringYes

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

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

C46FF5A8-C5F0-4024-8262-B16B639225A0
Successboolean

Indicates whether the operation is successful. Valid values:

  • true: yes
  • false: no
true

Examples

Sample success responses

JSONformat

{
  "RequestId": "C46FF5A8-C5F0-4024-8262-B16B639225A0",
  "Success": true
}

Error codes

HTTP status codeError codeError messageDescription
400NumberExceed.TagsThe maximum number of tags is exceeded.The number of tags has reached the upper limit.
400NumberExceed.ResourceIdsThe maximum number of resource IDs is exceeded.The number of resource group IDs exceeds the upper limit.
400Forbidden.TagKeysThe tag key cannot be operated by the request.You cannot manage the tag key by calling the operation.
400Forbidden.TagKey.DuplicatedThe specified tag key already exists.The tag resources are duplicate.
400InvalidInstanceIds.NotFoundThe instance IDs are not found.The instance ID is invalid.
400InvalidInstanceType.NotFoundThe instance type is not found.The instance type is invalid.

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2023-12-08API Description Update. The Error code has changedsee changesets
Change itemChange content
API DescriptionAPI Description Update.
Error CodesThe Error code has changed.
    delete Error Codes: 400