You can use resource tags and CloudOps Orchestration Service (OOS) to automate operations and maintenance (O&M) tasks across multiple resources. This topic describes how to use a public OOS template to start all Elastic Compute Service (ECS) instances that have a specific tag.
Solution overview
This solution uses tags to dynamically select target resources and then uses an OOS template to perform an action on those resources.
Tag your resources: You apply a consistent tag (such as
business:bigdata) to all ECS instances that belong to a specific application or environment.Run an OOS execution: You use a public OOS template that is designed to perform a bulk action. When you create the execution, you specify the target instances by providing the tag that you applied in the first step.
OOS then finds all instances with that tag and performs the specified action, such as starting the instances.
Step 1: Tag your ECS instances
First, ensure that the ECS instances you want to manage have the correct tag applied. For this example, we will use the tag business:bigdata.
Log on to the Resource Management console.
Navigate to the Tags page.
If the tag does not exist, create it. Otherwise, find the existing tag. In this example, create the tag
business:bigdata.In the Actions column for the tag, click Add to Resources and apply the tag to all the target ECS instances. For more information, see Create a tag and Add a tag.
Step 2: Create an OOS execution to start the instances
Next, use the ACS-ECS-BulkyStartInstances public template in OOS to start all instances that have the business:bigdata tag.
Log on to the OOS console.
In the left-side navigation pane, choose Automated Task > Public Template.
In the top navigation bar, select the region where your tagged ECS instances are located.
On the Public Template page, find the template named ACS-ECS-BulkyStartInstances and click Create Execution.
On the Basic Information step, you can keep the default settings. Click Next Step: Parameter Settings.
On the Parameter Settings step, configure the following parameters:
TargetInstance: Select Specify Instance Tags.
Instance Tag: For the tag key, select
business. For the tag value, selectbigdata.OOSAssumeRole: For this example, you can select Use Existing Permissions of Current Account. In a production environment, we recommend that you use a specific RAM role for improved security.
Click Next Step: OK.
Review the execution details and click Create.
Step 3: Verify the result
After the execution is created, OOS automatically starts the targeted instances.
Navigate to the execution's details page.
In the Execution Steps and Results section, click Starts the ECS instances.
Click the Loop Tasks tab to view the result for each individual instance that was started.