Virtual Private Cloud (VPC) supports tags. You can use tags to label and classify VPCs, route tables, and vSwitches, which facilitates resource search and aggregation. This topic describes how to manage tags for VPCs. You can manage tags for vSwitches and route tables the same way you manage tags for VPCs.

Tag overview

VPC tagging

As shown in the preceding figure, as the number of VPCs, route tables, or vSwitches increases, it becomes more difficult to manage these instances. You can use tags to group instances. This allows you to search and filter instances in a more efficient way.

Tags are used to classify instances. Each tag consists of a key and a value. To use tags, make sure that the following requirements are met:
  • 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, if you are in the China (Shanghai) region, you cannot view the tags of instances that are created in the China (Hangzhou) region.

  • You can modify the key and value of a tag or remove a tag from an instance.
  • If you delete an instance, all tags added to the instance are deleted. This operation does not affect the tags added to other instances.
  • You can add up to 20 tags to each instance. You cannot increase the quota.

Add tags to an instance

  1. Log on to the VPC console.
  2. In the top navigation bar, select the region where the VPC is deployed.
  3. On the VPCs page, perform the following operations to add tags to a VPC.
    • Add tags to an instance
        • If a VPC has no tag added, find the VPC and move the pointer over Tag in the Tags column. Then, click Add in the pop-up message.
        • If a VPC has tags added, find the VPC and move the pointer over Tag in the Tags column. Then, click Edit in the pop-up message.
      1. In the Configure Tags dialog box, specify the key and value and click OK.
        ParameterDescription
        Tag KeyYou can select or enter a tag key.

        The tag key must be 1 to 64 characters in length, and cannot start with aliyun or acs:. It cannot contain http:// or https://.

        Tag ValueYou can select or enter a tag value.

        The tag value can be 1 to 128 characters in length, but cannot start with aliyun or acs:. It cannot contain http:// or https://.

    • Add tags to multiple instances
      1. Select the VPCs to which you want to add tags and choose Configure Tags > Add Tags in the lower-left corner.
      2. In the Configure Tags for Multiple Resources dialog box, specify Tag Key and Tag Value, and click OK.

Search instances by tag

You can search instances by tag after you add tags to instances.

  1. Log on to the VPC console.
  2. In the top navigation bar, select the region where the VPC is deployed.
  3. On the VPCs page, click Filter by Tag.
  4. In the Filter by Tag dialog box, select or enter a tag key and a tag value, and click Search.
    You can select or enter a key-value pair, or select or enter only a tag key.

Remove tags from an instance

If a tag is added to more than one instance and you remove the tag from an instance, the tag is not removed from other instances.

  1. Log on to the VPC console.
  2. In the top navigation bar, select the region where the VPC is deployed.
  3. On the VPCs page, perform the following operations to remove tags from a VPC.
    • Remove tags from an instance
      1. Find the VPC from which you want to remove tags, move the pointer over Tag in the Tags column, and then click Edit in the pop-up message.
      2. In the Configure Tags dialog box, find the key-value pairs that you want to remove, click Delete on the right side, and then click OK.
    • Remove tags from multiple instances
      1. Find the instances from which you want to remove tags and choose Configure Tags > Delete Tags in the lower-left corner.
      2. In the Delete Tags for Multiple Resources dialog box, find the key-value pairs that you want to remove, click Delete on the right side, and then click OK.

References