Workflow overview

Updated at:
Copy as MD

Use the Auto Scaling API to build a complete auto-scaling solution that supports scheduled, dynamic, custom, and fixed-mode scaling.

Flowchart

The flowchart shows the complete setup sequence. Steps 1–3 produce a basic auto-scaling solution. Steps 4–5 extend it to a full solution.

image

Setup steps

  1. Create a scaling group (CreateScalingGroup): Define the minimum and maximum number of instances for the group. You can also attach Server Load Balancer (SLB) and ApsaraDB RDS instances at this step. For more information, see Creates a scaling group.

  2. Create a scaling configuration (CreateScalingConfiguration): Specify the Elastic Compute Service (ECS) instance attributes to use when the group scales out, such as the image ID and instance type. For more information, see Creates a scaling configuration.

  3. Enable the scaling group (EnableScalingGroup): Activate the scaling group using the scaling configuration ID from the previous step. After this step, your basic auto-scaling solution is ready. For more information, see Enables a scaling group.

  4. Create a scaling rule (CreateScalingRule): Define how resources scale in response to demand. For example, create a simple rule to add N ECS instances when triggered. For more information, see Create a scaling rule.

  5. Create an auto-scaling task to trigger the scaling rule automatically. Two task types are available:

    • Create a scheduled task (CreateScheduledTask): Execute a scaling rule at a specific time. For example, trigger scale-out at 12:00:00. For more information, see Create a scheduled task.

    • Create an event-triggered task (CreateAlarm): Execute a scaling rule based on CloudMonitor metrics. For example, automatically scale ECS instances when CPU utilization reaches or exceeds 80%. For more information, see Creates an event-triggered task.