Auto Scaling monitors the ECS instances in a scaling group by using event-triggered tasks and automatically executes a scaling rule to add or remove ECS instances when an alert is triggered. This topic describes how to use event-triggered tasks to automatically remove ECS instances from a scaling group.
Step 1: Create a scaling rule
- Log on to the Auto Scaling console.
- In the left-side navigation pane, click Scaling Groups.
- Find the scaling group and use one of the following methods to open the details page
of the scaling group:
- Click the ID of the scaling group in the Scaling Group Name/ID column.
- In the Actions column corresponding to the scaling group, click Details.
- In the upper part of the page, click the Scaling Rules tab.
- In the upper-left corner of the Scaling Rules tab, click Create Scaling Rule.
- Configure parameters for the scaling rule and click OK.The following table describes the parameters used in this example. For parameters that are not described in the following table, use the default values.
Parameter Example Rule Name To1 Rule Type Simple Scaling Rule Operation Change to 1 Instances
Step 2: Create an event-triggered task
- In the left-side navigation pane, choose .
- In the upper-right corner of the Event-Triggered Tasks page, click Create Event-Triggered Task.
- Configure parameters for the event-triggered task and click OK.The following table describes the parameters used in this example. For parameters that are not described in the following table, use the default values.
Parameter Example Description Task Name EventTriggeredScalingIn None Description Remove ECS instances when the average CPU utilization is less than 10%. None Resource Monitored MyFirstScalingGroup Monitors metrics of the MyFirstScalingGroup scaling group. Monitoring Type System Monitoring None Monitoring Metrics (ECS) CPU Usage Monitors the CPU utilization of ECS instances in the scaling group. Reference Period (Minutes) 1 Collects data once every one minute. Condition Average <= 10% If the average CPU utilization of ECS instances in the scaling group is less than or equal to 10%, data is recorded once. Trigger After 5 Times If the average CPU utilization of ECS instances in the scaling group is less than or equal to 10% for five times in a row, an alert is triggered. Triggered Rule To1 When the alert is triggered, the To1 scaling rule is executed. Auto Scaling adjusts the number of ECS instances in the scaling group to one.