As your cloud footprint expands, managing your resources becomes more complex. You might find it difficult to track costs or monitor resources in bulk. Tags help you classify resources for fine-grained management. By attaching tags, you can organize resources across various dimensions, such as by owner, purpose, or environment.
For more information, see What is a tag.
Use cases
As your number of ECS instances grows, tagging them makes it easier to perform searches and bulk operations. Common use cases for tags include:
-
Manage application deployment workflows
-
Track resources and manage them in groups based on tags
-
Automate group-based operations by using tags with services such as CloudOps Orchestration Service, Resource Orchestration Service (ROS), Auto Scaling, and Cloud Assistant
-
Manage costs and allocate expenses based on tags
-
Design resource-based or role-based access control
This topic describes the following two use cases in detail. For more use cases, see What is a tag.
Use case 1: Resource management and automation
You can bind different tags for various dimensions, such as environment (production or test), operating system (Windows or Linux), or client platform (iOS or Android). For example, you can bind a key-value pair such as Test:Server-Windows to all ECS instances in your test environment. This lets you quickly filter for these instances during maintenance.
Examples of bulk operations:
-
Replace an image to deploy an application
-
Apply patches
-
Add security group rules to control network access
For more information, see Use tags to retrieve ECS instances and add them to a matching security group.
-
Use CloudOps Orchestration Service to bulk start, stop, or restart ECS instances
For more information about how to start instances in bulk, see Use OOS to start multiple ECS instances with a specified tag.
-
Use Cloud Assistant to run O&M scripts on multiple ECS instances
For an example of how to run Cloud Assistant commands on tagged instances, see Use tags to control the execution of Cloud Assistant commands.
Use case 2: Team and project management
For team or project management, you can add tags that represent dimensions such as groups, projects, or departments, for example, CostCenter:aliyun. You can then use these tags to group resources, manage cost allocation in the Expenses and Costs console, or configure cross-account access.
For more information, see the following topics:
Usage notes
Each tag is a key-value pair. For any given resource, each tag key must be unique.
Before you use tags, you must understand their limits and quotas. For more information, see What is a tag.
Create and bind tags
Before you create tags, see Tag design principles for background information and examples. Follow these steps to create and bind a tag:
You can bind a maximum of 20 tags to a single resource. If a resource already has 20 tags, you must unbind some tags before you can bind new ones.
Go to ECS console - Tags.
In the upper-left corner of the page, select a region and resource group.
-
On the Custom Tags tab, click Create Custom Tag.
-
On the Create Custom Tag page, perform the following steps.
When you create a custom tag, you must also bind it to a resource. If you want to create a tag without immediately binding it to a resource, use a preset tag. For more information, see Create a tag.
-
Create a new tag.

The following table describes the parameters.
Parameter
Required
Description
Tag Key
Yes
Enter a new tag key or select an existing one.
-
A new tag key can be up to 128 characters long. It cannot start with aliyun or acs:, nor can it contain http:// or https://.
-
When you select an existing tag key, fuzzy search is supported.
Value
No
Enter a tag value.
The tag value can be up to 128 characters in length and cannot contain http:// or https://.
NoteYou can create multiple tags that have the same tag key but different tag values. To do this, select an existing tag key and enter a new tag value.
-
-
Click Next.
-
Configure the parameters to bind the tag to resources.
The following table describes the parameters.
Parameter
Description
Example
Method for Specifying Resources
You can specify resources in one of the following ways:
-
Select from Resource List: Select one or more resources from the list.
-
Enter Resource IDs: Enter the resource IDs in the Search by resource ID text box.
Note-
Separate multiple resource IDs with commas (,) or line breaks.
-
You can bind a maximum of 20 tags in a single operation.
-
Enter Resource IDs
Service
Select the resource type. For example, for ECS, you can select Instance, cloud disk, or snapshot.
Elastic Compute Service:Instance
Search by resource ID
Enter the ID of the ECS instance.
i-bp12d03u8usvakpo****
-
-
Click OK.
-
Optional: View the bound resources.
After the tag is created and bound, click the
icon above the tag list on the Custom Tags tab. Find the tag and click View Resources in the Actions column.
-
Unbind or delete tags
If a tag is no longer needed, you can unbind it from resources. This section uses the following example to show how to unbind a tag: unbinding the ECS:Documentation tag (tag key: ECS, tag value: Documentation) from an Elastic Compute Service:Instance resource.
-
You can unbind a maximum of 20 tags at a time.
-
After you unbind a tag from all its associated resources, the system automatically deletes the tag within 24 hours.
-
On the Custom Tags tab, select Instance from the resource type drop-down list.
-
In the tag list, find the ECS:Documentation tag that you want to unbind. Go to the Resources page by using one of the following methods:
-
Method 1: Click the ECS tag key. In the row for the Documentation tag value, click View Resources in the Actions column.
-
Method 2: In the row for the ECS tag key, click View Resources in the Actions column.
-
-
On the Resources tab, unbind the tag from one or more resources.
-
To unbind the tag from a single resource: Find the resource and click Disassociate from Resource in the Actions column.
-
To unbind the tag from multiple resources: Select the resources and then click Unbind Current Tag or Unbind Tags.

-
-
In the Disassociate from Resource dialog box, click OK.
After the tag is unbound, click the
icon on the Resources page. You can verify that the tag has been unbound from the resource.
Tagging best practices
Common uses include:
-
Find or export resources
-
Use the Tag Editor to edit resource tags and export resource information. For more information, see Tag Editor.
-
Perform exact and fuzzy searches for cloud resources that have a specific tag. For more information, see Use tags to find resources.
-
-
Use tags to control resource access
-
Group ECS instances by using tags and grant permissions to the groups. This ensures that Resource Access Management (RAM) users can view and manage only the resources they are authorized to access. For more information, see Use tags to authorize access to groups of ECS instances.
-
Specify authorized tags in custom policies in RAM to restrict RAM users to viewing and managing only specific ECS instances. For more information, see Use tags to restrict RAM users from managing specific ECS instances.
-
-
Use tags for automated operations
-
Use OOS to bulk start multiple ECS instances with a specific tag. For more information, see Use OOS to start multiple ECS instances with a specified tag.
-
Use a public template provided by OOS to create an execution that enables the cloud disks, elastic network interfaces (ENIs), elastic IP addresses (EIPs), snapshots, and custom images of an ECS instance to inherit its tags in bulk. For more information, see Inherit ECS instance tags for associated resources in bulk.
-
Use a public template provided by OOS to create an execution that retrieves ECS instances with a specific tag and adds them to a security group that has the same tag. For more information, see Use tags to retrieve ECS instances and add them to a matching security group.
-
Bind the same tag to multiple ECS instances and then use the intelligent tag synchronization feature of CloudMonitor to automatically add them to the same application group for automated group monitoring. For more information, see Use tags to automatically add ECS instances to a CloudMonitor application group.
-
Bulk run Cloud Assistant commands or upload files to ECS instances with a specific tag. For more information, see Use tags to control the execution of Cloud Assistant commands.
-
Related topics
-
You can also use resource groups to group your cloud resources based on dimensions such as purpose, permissions, and ownership. This allows for hierarchical management of resources for multiple users and projects within an enterprise. For more information, see What is a resource group? or Resource groups.
-
Call the TagResources API operation to create and bind tags.
-
Call the ListTagResources API operation to query the tags that are bound to a resource.
-
Call the UntagResources API operation to unbind tags from specified resources.
-
Call the JoinResourceGroup API operation to add an ECS resource or service to a resource group.

