All Products
Search
Document Center

Resource Management:Add tagged ECS instances to matching security groups

Last Updated:Jun 04, 2026

Use a CloudOps Orchestration Service (OOS) public template to find ECS instances by tag and add them to security groups with the same tag.

Context

This example adds ECS instances tagged Team:Dev to the security group with the same tag.

Procedure

  1. Log on to the OOS console.

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

  3. In the upper-left corner of the top navigation bar, select a region.

    Note

    OOS manages resources only in the selected region. Select the same region as your ECS instances. Specifying regionId in some templates for cross-region API calls is not recommended. Limits.

  4. On the Public Template page, find ACS-ECS-CorrectSecurityGroupInstancesByTags and click Create Execution.

  5. On the Basic Information page, enter basic information and click Next: Set parameters.

    This example uses default values for Basic Information.

    Note

    For Execution Mode, select Automatic. All tasks run automatically.

  6. On the Parameter Settings page, set the parameters and click Next: OK.

    1. For Region ID, select the region of your ECS instances.

    2. In the Tags section, enter the tag for your ECS instances.

      OOS finds ECS instances with this tag and adds them to the security group with the same tag.

      Important

      The ECS instances and the security group must be in the same VPC. Otherwise, the execution fails.

  7. Verify the information and click Create.

Result

A Successful status means the Team:Dev ECS instances were added to the matching security group. In the ECS console instance list, verify that the instances belong to the correct security group.