All Products
Search
Document Center

Elastic Compute Service:Categorize and manage ECS resources with tags

Last Updated:May 15, 2026

Attach key-value pair tags to ECS resources for grouping, batch operations, cost splitting, and access control.

See What are tags? for tag concepts and details.

Use cases

Tags simplify searching and batch operations on ECS resources. Common use cases include:

  • Manage application release processes

  • Retrieve and manage resources in groups

  • Automate group-based O&M with CloudOps Orchestration Service, Resource Orchestration Service, Auto Scaling (ESS), and Cloud Assistant

  • Manage costs and split bills

  • Design access control for resources or roles

The following two scenarios are described in detail. See What are tags? for more use cases.

Optimize ECS resource management and automate O&M

Attach tags to differentiate environments (production, staging), operating systems (Windows, Linux), or platforms (iOS, Android). For example, attach Test:Server-Windows to all staging instances to quickly filter them during maintenance.标签应用场景示例二

Examples of batch operations:

Manage teams and projects

Add tags based on group, project, or department dimensions, such as CostCenter:aliyun, for grouping, bill splitting in User Center, or cross-account authorization.标签应用场景示例

Related topics:

Usage notes

Tags are key-value pairs. Each tag key attached to a resource must be unique.

Important

Review tag limits and quotas in What are tags? before using tags.

ECS resources that support tags

  • ECS instances

  • Cloud Disk

  • Reserved instances

  • Elastic Block Storage

  • Snapshots

  • Snapshot-consistent groups

  • Automatic snapshot policies

  • (image)

  • Image components

  • Image templates

  • Security groups

  • Elastic network interfaces (ENIs)

  • Dedicated Hosts

  • SSH key pairs

  • Launch templates

  • Dedicated host clusters

  • Elastic assurances

  • Capacity reservations

  • Storage Capacity Units (SCUs)

  • Cloud Assistant commands

  • Results of Cloud Assistant command executions or file deliveries

  • Managed instances for Cloud Assistant

  • Activation codes for managed instances for Cloud Assistant

Create and attach tags

Before creating tags, see Tag design principles for background and examples. To create and attach tags:

Important

A maximum of 20 tags can be attached to a single resource. Detach existing tags before attaching new ones if you reach this limit.

  1. Go to ECS console - Tags.

  2. In the upper-left corner of the page, select a region and resource group.地域

  3. On the Custom Tags tab, click Create Custom Tag.

  4. On the Create Custom Tag page, complete the following steps.

    You must attach a resource when creating a custom tag. To create a tag without attaching it, use predefined tags. See Create a tag.

    1. Create a new tag.

      tag

      Parameters:

      Parameter

      Required

      Description

      Tag Key

      Yes

      Enter a new tag key or select an existing one.

      • A new key can be up to 128 characters and cannot start with aliyun or acs:. It cannot contain http:// or https://.

      • Fuzzy search is supported when selecting an existing key.

      Value

      No

      Enter a new tag value.

      A new value can be up to 128 characters and cannot contain http:// or https://.

      Note

      The same tag key can have different values. You can create a new tag by selecting an existing key and entering a new value.

    2. Click Next.

    3. Configure the resource attachment parameters.

      Parameters:

      Parameter

      Description

      Example

      Resource Selection Method

      Select resources in one of the following ways:

      • Select from Resource List: Select one or more resources from the list.

      • Enter Multiple Resource IDs: Enter resource IDs in the Search by resource ID text box.

        Note
        • Enter multiple resource IDs on separate lines or separate them with commas (,).

        • You can attach a maximum of 20 tags per request.

      Enter Multiple Resource IDs

      Service

      The resource type. ECS resources include instances, disks, and snapshots.

      Elastic Compute Service:Instance

      Enter Resource ID

      The ECS instance ID.

      i-bp12d03u8usvakpo****

    4. Click OK.

    5. (Optional) View attached resources.

      After creating and binding a tag, click the tag1 icon above the Custom Tags list, find the tag, and click View Resources in the Actions column.

      check resource

Detach or delete tags

If a tag is no longer needed, detach it from the resource. This example detaches the tag ECS:Documentation (key: ECS, value: Documentation) from an Elastic Compute Service: Instance resource.

Important
  • You can detach a maximum of 20 tags at a time.

  • After a tag is detached from all resources, it is automatically deleted within 24 hours.

  1. On the Custom Tags tab, set the resource type to Instance.

  2. In the tag list, locate the ECS:Documentation tag to detach. Go to the Resources page in either of the following ways.

    • Method 1: Click the ECS tag key. Find the Documentation tag value and click View Resources in the Actions column.

    • Method 2: For the ECS tag key, click View Resources in the Actions column.

  3. On the Resources tab, detach the tag from one or more resources.

    • To detach from a single resource: find the resource and click Detach Resource in the Actions column.

    • To detach from multiple resources: select the resources and click Detach Current Tag or Unbind Tags.

    remove resources

  4. In the Detach Resource dialog box, click OK.

    After detaching the tag, click the tag1.png icon on the Resources page to confirm the tag is no longer associated with the resource.

Best practices for tags

Common tag use cases and corresponding operations:

References