All Products
Search
Document Center

CloudOps Orchestration Service:Remove a spot instance from a Server Load Balancer backend server list before release

Last Updated:Feb 27, 2026

Preemptible instances are automatically released when market prices change or resource inventory is adjusted. About 5 minutes before the release, an event notification is sent. CloudOps Orchestration Service (OOS) listens for this notification and removes the instance from the Server Load Balancer (SLB) backend server list before the release occurs.

Without this automation, the SLB instance must detect the release on its own, which may cause brief service disruption.

When to use this template

Use the ACS-ECS-RemoveFromSLBWhenPreemptibleInstanceInterrupted public template when preemptible instances serve as backend servers for an SLB instance and you want to drain traffic before release.

How it works

  1. Monitors the event that indicates a preemptible instance is to be released.

  2. Queries the ID of the SLB instance to which the preemptible instance is added as a backend server.

  3. Sets the weight of the preemptible instance to 0 in the SLB instance.

  4. Waits until the established network connection is closed.

  5. Removes the preemptible instance from the backend server list of the SLB instance.

Procedure

Configure the OOSAssumeRole parameter -- the Resource Access Management (RAM) role that OOS assumes. The template also includes an optional Tags parameter (default: empty).

  1. Log on to the OOS console.

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

  3. Search for ACS-ECS-RemoveFromSLBWhenPreemptibleInstanceInterrupted.

  4. Click Create Execution.

  5. On the Create Task page, configure the required parameters in the Basic Information step, then click Next Step: Parameter Settings.

  6. Click Next Step: OK. In the OK step, click Create.

Verify the execution

After the execution is created, go to the Task Execution Management page to check the execution state. A state of Waiting means OOS is monitoring preemptible instances. When a preemptible instance is about to be released, the subsequent task defined in the template (containing the EventTrigger action) executes immediately.