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
-
Log on to the OOS console.
-
In the left-side navigation pane, choose .
-
In the upper-left corner of the top navigation bar, select a region.
NoteOOS manages resources only in the selected region. Select the same region as your ECS instances. Specifying
regionIdin some templates for cross-region API calls is not recommended. Limits. -
On the Public Template page, find ACS-ECS-CorrectSecurityGroupInstancesByTags and click Create Execution.
-
On the Basic Information page, enter basic information and click Next: Set parameters.
This example uses default values for Basic Information.
NoteFor Execution Mode, select Automatic. All tasks run automatically.
-
On the Parameter Settings page, set the parameters and click Next: OK.
-
For Region ID, select the region of your ECS instances.
-
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.
ImportantThe ECS instances and the security group must be in the same VPC. Otherwise, the execution fails.
-
-
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.