Tags can be used to identify resources. You can use tags to classify Message Queue for Apache RocketMQ resources. Tags can help you search for resources and aggregate resources. Message Queue for Apache RocketMQ allows you to add, modify, and remove tags for instances, topics, and groups. This topic describes the scenarios in which you can use tags, the instructions about how to use tags, limits of tags, and operations on tags.

Scenarios

When the created Message Queue for Apache RocketMQ resources increase, resource management becomes more difficult. You can use resource names to identify resources. You can also use tags to classify resources based on different dimensions such as business, purposes, and objects. After you attach tags to resources, you can quickly query and filter resources of a specified type by using tags.

If you do not configure tags, you can manage and identify the following topic resources only by topic names. The number of topics increases and it is more difficult to manage topics due to business growth. You can classify topics based on business scenarios and configure the same tag for topics that are used for the same business scenario. After tags are configured, you can query topics in a business scenario by using a specified tag key and tag value. This helps you quickly filter and manage topics. The following figure shows how to manage tags. Manage tags

Usage notes

  • Each tag consists of a key-value pair.
  • Each tag key must be unique in a resource.

    For example, the city:shanghai tag is attached to a Message Queue for Apache RocketMQ instance. Before you attach the city:shenzhen tag to the instance, delete the city:shanghai tag.

  • For more information about tags, see Best practices for tag design.

Limits

  • Each tag key must be 1 to 64 Unicode characters in length. Each tag key is case-sensitive.
  • Each tag value must be 1 to 64 Unicode characters in length. Each tag value is case-sensitive.
  • A maximum of 20 tags can be attached to each resource.
  • A tag key cannot start with aliyun or acs:, contain http:// or https://, or be an empty string.
  • A tag value cannot contain http:// or https://. The tag value can be an empty string.
  • Tags cannot be used across regions. For example, in the China (Shanghai) region, you cannot view the tags that are created in the China (Hangzhou) region.

Add a tag

Note The operations that you can perform on tags of instances, topics, and groups are similar. This section describes how to add a tag to an instance.
  1. Log on to the Message Queue for Apache RocketMQ console.
  2. In the left-side navigation pane, click Instances.
  3. In the top navigation bar, select the region where your instance is deployed. For example, you can select China (Hangzhou).
    On the Instances page, the instances that are deployed in this region are displayed.
  4. On the Instances page, find the instance to which you want to add a tag, move the pointer over the tag_icon icon in the Tags column, and then click Add.
    Instance tags
  5. In the panel that appears, configure the Label Key and Label Value parameters. Then, click OK.
    edit_label_talk
    If the tag_icon icon in the Tags column changes to the tag_icon_success icon, the tag is added.

Use a tag to filter resources

Note The operations that you can perform on tags of instances, topics, and groups are similar. This section describes how to use a tag to filter instances.
  1. On the Instances page, click Select Tag.
    Select a tag
  2. Select a tag key from the Label Tag drop-down list, select a tag value from the Label Value drop-down list, and then click Search.
    Only the instances with the specified tag are displayed in the list. Filter result

Modify or delete a tag

Note The operations that you can perform on tags of instances, topics, and groups are similar. This section describes how to modify or delete a tag of an instance.
  1. On the Instances page, find the instance whose tags you want to manage, move the pointer over the tag_icon_success icon in the Tags column, and then click Edit.
    Modify a tag
  2. In the panel that appears, perform the following operations based on your business requirements:
    • Modify a tag: Change the values of the Label Key and Label Value parameters or enter a new key-value pair in a new row, and then click OK. modify_label_talk
    • Delete a tag: Find the key-value pair that you want to delete and click the tag_delete icon next to the pair. Then, click OK. remove_lable_talk

Notes

You can call the following API operations to manage tags: