All Products
Search
Document Center

CloudOps Orchestration Service:Use OOS to automatically start ECS instances that are unexpectedly stopped

Last Updated:Sep 04, 2024

In extreme cases, Elastic Compute Service (ECS) instances may be unexpectedly stopped. You can use the event trigger of CloudOps Orchestration Service (OOS) to monitor ECS instances. If ECS instances are unexpectedly stopped, OOS automatically starts the ECS instances. In this case, the ACS-ECS-AutoStartECSWhenStoppedByTags template is used.

Process

  1. Add tags to ECS instances within your Alibaba Cloud account.

  2. Monitor the ECS instances.

  3. If ECS instances are stopped, check whether the ECS instances need to be started.

  4. Check whether the stopped ECS instances are to be automatically started. If no, ignore the stopped ECS instances. If yes, perform subsequent operations.

  5. Start the stopped ECS instances.

  6. Wait until the stopped ECS instances are started.

Operations performed by the public template

  1. Monitor the stopped ECS instances.

  2. Check whether the ECS instances have the specified tags.

  3. If the ECS instances do not have the specified tags, ignore the stopped ECS instances.

  4. If the ECS instances have the specified tags, start the ECS instances.

Template parameters

  • tags: the tags of the ECS instances to be automatically started.

  • OOSAssumeRole: the Resource Access Management (RAM) role assumed by OOS.

Procedure

  1. Log on to the CloudOps Orchestration Service console.

  2. In the left-side navigation pane, choose Automated Task > Public Template. On the Public Template page, enter ACS-ECS-AutoStartECSWhenStoppedByTags in the search box. Find the ACS-ECS-AutoStartECSWhenStoppedByTags template.

  3. Click Create Execution.

  4. On the Create Task page, click Next Step: Parameter Settings. Configure the parameters.

  5. Click Next Step: OK and then click Create. On the Task Execution Management page, view the created execution. If the execution is in the Valid state, your ECS instances are monitored. If ECS instances are stopped, the ACS::EventTrigger action is triggered to perform subsequent operations.

  6. Monitor ECS instances. The following figure shows three running ECS instances with the specified tags.

  7. Manually stop the three ECS instances to simulate the case that ECS instances are unexpectedly stopped.

  8. After the ECS instances are stopped, the state of the execution changes from Valid to Running. OOS starts the stopped ECS instances.

  9. After a period of time, view the status of the ECS instances. The stopped ECS instances with the specified tags are automatically started, and their state changes to Running.