Instance removal policy

更新时间:
复制 MD 格式

When the workload decreases, your scaling group initiates a scale-in event based on its configuration. During a scale-in event, the scaling group removes instances based on the configured Scale-In Policy. This topic describes how to configure an instance removal policy.

How it works

When a scaling group must remove an instance and multiple are eligible, this policy determines which one to remove. If multiple instances still meet the criteria, the scaling group removes one at random. The Scale-In Policy supports the following options.

Important

When the Type is ECI, you cannot configure an Scale-In Policy. The default Scale-In Policy for ECI scaling groups is to first remove Instances Created From Earliest Scaling Configuration and then remove Earliest Instances.

  • Instances Created From Earliest Scaling Configuration

    This policy removes instances that were created from the earliest scaling configuration. If multiple instances qualify, the scaling group removes one at random. You can also configure the Then Remove option to further narrow down the selection of instances.

    Note
    • In this context, a scaling configuration refers to the instance configuration source for the scaling group, which includes a Scaling Configuration or a Launch Template.

    • A Scaling Configuration is not associated with a Launch Template or Launch Template and is not selected first for removal. If a scaling group still needs to remove instances after all associated instances are removed, the scaling group removes a manually added instance at random.

    • The version number of a launch template does not determine the age of a scaling configuration. For example, if a scaling group first uses version 2 of a launch template and is then rolled back to version 1, version 2 is considered the earliest scaling configuration.

  • Earliest Instances

    This policy removes the oldest ECS instances.

  • Most Recent Instances

    This policy removes the newest ECS instances.

  • Custom Policy

    If the preceding policies do not meet your requirements, you can use a Custom Policy. With this policy, each time a scale-in event is triggered, the scaling group calls a function that you configure. The custom function selects which instances to remove. If multiple instances are returned, the scaling group removes one at random. You can also configure the Then Remove and Then Remove options to further refine the selection. For information about how to use a function to customize an instance removal policy, see Use Function Compute to customize ECS scale-in policies.

Configure an instance removal policy

For an existing group

Follow these steps to modify the Scale-In Policy of a scaling group.

  1. Log on to the Auto Scaling console.

  2. In the left-side navigation pane, click Scaling Groups.

  3. In the top navigation bar, select the region where Auto Scaling is activated.

  4. On the Scaling Groups page, find the scaling group to modify and click Edit in the Actions column.

  5. On the Edit Scaling Group page, set the Scale-In Policy to the desired policy.

  6. Click OK to save the configuration.

For a new group

When you create a scaling group, configure the Scale-In Policy.

For example, you can set the first-priority policy to Instances Created from Earliest Scaling Configuration and the second-priority policy to Earliest Instances.

To create a scaling group, see Create a scaling group for ECS instances.