This topic describes how to add tags to resources in ApsaraMQ for Kafka, such as instances, topics, and Groups, to help you categorize and efficiently manage resources based on tags.
Background
A tag is a key-value pair that you can use to identify your ApsaraMQ for Kafka resources. If you have multiple types of ApsaraMQ for Kafka resources with various relationships under your account, you can use tags to group resources that serve the same purpose or are related. This practice simplifies resource searches and batch operations, improving your daily operational and troubleshooting efficiency.
Usage
A tag is a key-value pair.
The tag key must be unique for each resource.
For example, if you first tag an ApsaraMQ for Kafka instance with
city:shanghaiand later tag it withcity:newyork, thecity:shanghaitag is automatically removed.Tags are region-specific. For example, a tag created in the China (Hangzhou) region is not visible in the China (Shanghai) region.
When you remove a tag from a resource, the tag is automatically deleted if it is no longer bound to any other resources.
For guidance on designing tag keys and values, see Tags.
Limitations
You can add a maximum of 20 tags to a single resource.
You can add a single tag to a maximum of 50 resources.
You can add a maximum of 20 tags in a single operation.
Add tags
Add tags to ApsaraMQ for Kafka resources such as instances, topics, and groups to categorize them.
Log on to the ApsaraMQ for Kafka console. On the Overview page, select a region in the Resource Distribution section.
In the left-side navigation pane, choose .
On the Tags page, click Resource Management console.
In the left-side navigation pane, choose . On the Custom Tags tab, click Create Custom Tag.
ImportantYou can create a maximum of 20 unique tags in a single operation.
In the Create Custom Tag dialog box, perform the following steps:
In the Create or select tags step, configure the following parameters and click Next.
In the Tag Key field, enter a tag key or select an existing one from the drop-down list.
In the Tag Value field, enter a tag value or select an existing one from the drop-down list.
In the Add to resources step, choose one of the following methods to select resources:
ImportantYou can select a maximum of 50 resources of the same type.
Click Select from Resource List. You can search for resources by using the Resource type, Resource group, and Tags drop-down lists, or by entering a Resource ID in the search box. In the search results, select the checkboxes for the target resources and click OK.
Click Enter Resource IDs. Select a product, enter one or more resource IDs separated by commas (,), and then click OK.
On the Tag page, you can view the created tags. Click View Resources to see the resources bound to a specific tag.
Edit tags
If a tag is unsuitable for resource categorization or retrieval, you can edit it to manage your resources more efficiently.
You can edit tags for instances, topics, or groups.
Edit tags for an instance
On the Instances page, find the instance whose tags you want to edit. In the tag column, hover over the
icon and click Edit.In the Edit tags for instance panel, find the Tag Key that you want to modify.
Update the Tag Key and Tag Value fields, and then click OK.
Edit tags for a topic
On the Instances page, click the name of the target instance.
In the left-side navigation pane, click Topics.
On the Topics page, find the topic whose tags you want to edit. In the tag column, hover over the
icon and click Edit.In the Edit tags for topic panel, find the tag you want to modify, edit the tag key and tag value, and then click OK.
Edit tags for a group
On the Instances page, click the name of the target instance.
In the left-side navigation pane, click Groups.
On the Groups page, find the group whose tags you want to edit. In the tag column, hover over the
icon and click Edit.In the Edit tags for group panel, find the tag you want to modify, edit the tag key and tag value, and then click OK.
Currently, you cannot add tags to topics or groups in serverless instances.
Search by tag
After tagging resources, you can use the tags to search for them.
Go to the Resource Management console.
In the left-side navigation pane, choose Tag > Tag > Custom Tags.
In the search box, enter a tag key to perform a fuzzy search. Find the target tag and click View Resources in the Actions column.
NoteIf no tag value is specified, Null is displayed.
On the Resources page, view the resources that have the specified tag.
Remove tags
If a tag is no longer needed or was assigned to the wrong resource, you can remove it from multiple resources in a single operation.
After a tag is removed from a resource, the tag is automatically deleted if it is no longer bound to any other resources.
Go to the Resource Management console.
In the left-side navigation pane, choose Tag > Tag > Custom Tags.
Find the target tag and click View Resources. On the Resources tab, select one or more resources from which you want to remove the tag.
To remove the tag from a single resource: Find the resource and click Unbind Resource in the Actions column.
To remove the tag from multiple resources: Select the checkboxes of the target resources and click Actions > Remove current tag below the resource list.
In the prompt that appears, carefully read the message and click Remove.