All Products
Search
Document Center

Resource Management:Bulk update tag values using OOS

Last Updated:Jun 04, 2026

Create a custom CloudOps Orchestration Service (OOS) template to bulk update tag values across hundreds of resources in a region.

Prerequisites

ECS instances are tagged. Create a tag, Add a tag to a resource.

Overview

This example changes the tag on hundreds of ECS instances from TagKey:OldTagValue to TagKey:NewTagValue.

Note

Step 1: Create a template

Create a custom OOS template to bulk update tag values:

  1. Log in to the OOS console.

  2. In the left-side navigation pane, choose Automated Task > Custom Template.

  3. In the top menu bar, select a region.

  4. Click Create Template.

  5. Click the JSON tab and enter the template content.

    Example:

    {
        "Description": "Bulk update the tag values of resources.",
        "FormatVersion": "OOS-2019-06-01",
        "Parameters": {
            "operateId": {
                "Description": "Enter a custom operation ID.",
                "Type": "String",
                "MinLength": 1,
                "MaxLength": 64
            },
            "tagKey": {
                "Description": "The key of the tag to update.",
                "Type": "String",
                "MinLength": 1,
                "MaxLength": 64
            },
            "tagValue": {
                "Description": "The current value of the tag.",
                "Type": "String",
                "MinLength": 1,
                "MaxLength": 64
            },
            "newTagValue": {
                "Description": "The new value for the tag.",
                "Type": "String",
                "MinLength": 1,
                "MaxLength": 64
            }
        },
        "Tasks": [
            {
                "Name": "DescribeInstances_ECS",
                "Action": "ACS::ExecuteAPI",
                "Description": {
                    "en": "Filter ECS instances by tags"
                },
                "Properties": {
                    "Service": "ECS",
                    "API": "DescribeInstances",
                    "AutoPaging": true,
                    "Parameters": {
                        "Tags": [
                            {
                                "Key": "{{ tagKey }}",
                                "Value": "{{ tagValue }}"
                            }
                        ]
                    }
                },
                "Outputs": {
                    "Instances": {
                        "Type": "List",
                        "ValueSelector": "Instances.Instance[].InstanceId"
                    }
                }
            },
            {
                "Name": "TagResources_ECS_Instances",
                "Action": "ACS::ExecuteAPI",
                "Description": {
                    "en": "Update tags for ECS instances"
                },
                "Properties": {
                    "Service": "ECS",
                    "API": "TagResources",
                    "Parameters": {
                        "Tags": [
                            {
                                "Key": "{{ tagKey }}",
                                "Value": "{{ newTagValue }}"
                            }
                        ],
                        "ResourceType": "Instance",
                        "ResourceId": [
                            "{{ACS::TaskLoopItem}}"
                        ]
                    }
                },
                "Loop": {
                    "MaxErrors": "100%",
                    "Concurrency": 20,
                    "Items": "{{DescribeInstances_ECS.Instances}}"
                }
            }
        ],
        "Outputs": {}
    }
  6. Click Create Template.

  7. In the Template Basic Information dialog box, enter the template name, tag, resource group, and version description.

  8. Click OK.

Step 2: Run the template

Run the template from Step 1 to update tag values in bulk.

  1. On the Custom Template page, locate the template from Step 1 and click Create Execution in the Actions column.

  2. Enter an Execution Description, select an Execution Mode, then click Next: Set Parameters.

  3. Enter the parameters, then click Next: Confirm.

    Parameters:

    • operateId: Custom identifier for this execution.

    • tagKey: Tag key to update. Example: TagKey.

    • tagValue: Current tag value. Example: OldTagValue.

    • newTagValue: Replacement tag value. Example: NewTagValue.

  4. Click Create.

    After execution, you are redirected to the details page to view the results.

    Note

    If execution fails, check the execution log for details.