Auto Scaling is a web service that automatically adds or removes instances to handle your business workloads based on scaling policies. You can use Auto Scaling to scale Elastic Compute Service (ECS) instances or elastic container instances. Auto Scaling is suitable for applications on which workloads fluctuate and applications on which workloads are stable.
The following video shows how to use Auto Scaling to scale ECS instances.
To ensure that sufficient computing resources are available, you can use Auto Scaling to add instances of the specified type during peak hours. To prevent waste of resources and reduce costs, you can use Auto Scaling to remove instances of the specified type during off-peak hours. If workloads fluctuate on your application, you can use Auto Scaling to automatically change the number of instances of the specified type to meet your business requirements.
|Cost-effectiveness||If you use Auto Scaling, you do not need to invest a lot of manpower to adjust the number of instances on which your application runs or prepare instances before traffic spikes occur. With Auto Scaling, you have no idle resources. Auto Scaling automatically scales instances to help you reduce resource costs. |
Auto Scaling automatically monitors the changes in metric values or in the expected number of instances in a scaling group. The default statistical period is 1 minute. If Auto Scaling detects that the metric values are not within the allowed range, Auto Scaling immediately triggers scaling activities. The following factors may affect the scaling speed:
|High availability||You can use Auto Scaling to perform health checks on ECS instances or elastic container instances to ensure high availability of your application. Auto Scaling automatically checks the health status of your instances. If Auto Scaling detects that an instance is unhealthy, Auto Scaling automatically adds an instance to replace the unhealthy instance. The new instance and the unhealthy instance must be of the same type.|
|Flexibility and intelligence|
|Easy audit||Auto Scaling logs the details of each scaling activity and monitors scaling groups. This can help identify and resolve issues in an effective manner.|
For more information, see Benefits.
Auto Scaling supports the scale-in and scale-out of Elastic Compute Service (ECS) instances and elastic container instances. Auto Scaling does not support the configuration changes of a single ECS instance or elastic container instance. To change the configurations of an ECS instance or an elastic container instance, you can activate Alibaba Cloud Operation Orchestration Service (OOS). The configurations include the number of CPU cores, the memory size, and the bandwidth. For more information, see Introduction to OOS.
Auto Scaling can automatically scale ECS instances or elastic container instances based on your business requirements. The following table describes the main components of Auto Scaling.
|Scaling group||A scaling group contains instances of the same type that you can use for similar business scenarios. You can configure a scaling group to specify the type of instance to which computing resources are allocated. You can also specify the instance configuration source, the maximum number and minimum number of instances, and the SLB server group with which you want to associate the scaling group. If you want to use Auto Scaling in multiple scenarios, you can create more than one scaling group. Auto Scaling automatically allocates computing resources to each scaling group based on your configurations.|
|Instance configuration source||An instance configuration source specifies information about the template that is used to manage your ECS instances or elastic container instances. Auto Scaling uses the template of the ECS type to create ECS instances and the template of the Elastic Container Instance type to create elastic container instances during scale-outs.|
|Scaling rule||A scaling rule is used to trigger a scaling activity. For example, you can create a scaling rule that triggers a scale-out activity in which an ECS instance or elastic container instance is added. You can manually run scaling rules. You can create event-triggered tasks or scheduled tasks to automatically run scaling rules. You can also create scaling rules to automatically change the maximum or minimum number of instances that are allowed in your scaling group.|
|Event-triggered task||Auto Scaling is integrated into CloudMonitor to monitor the metrics of your scaling group in real time. If the monitored metrics reach the specified thresholds, scaling rules are executed.|
|Scheduled task||You can create scheduled tasks to automatically execute scaling rules at the specified points in time.|
Auto Scaling also provides the following features to meet diverse requirements:
- If a scaling activity succeeds, fails, or is rejected, Auto Scaling sends notifications by using the methods that are described in the following table.
Feature Description Message notification Auto Scaling sends notifications by using text messages, internal messages, and emails. Event notification Auto Scaling automatically sends notifications to CloudMonitor or Message Service (MNS). If you use MNS, notifications are sent to the specified MNS topic or MNS queue. You are charged when you use MNS. For more information about the pricing of MNS, see Pricing.
- To help you manage instances in a scaling group, Auto Scaling also supports the features that are described in the following table.
Feature Description Lifecycle hook Auto Scaling provides the lifecycle hook feature to help manage the lifecycles of ECS instances or elastic container instances in a scaling group. During a scaling activity, a lifecycle hook can be triggered to switch the status of ECS instances or elastic container instances in your scaling group to Pending Add or Pending Remove. You can perform any operations on the instances until the lifecycle hook times out. Manually manage instances in a scaling group You can manually add ECS instances or elastic container instances to a scaling group, or remove ECS instances or elastic container instances from a scaling group. Rolling update If your scaling group contains a group of ECS instances, you can use the rolling update feature to manage the ECS instances. You can create rolling update tasks to update the configurations of multiple ECS instances at a time. For example, you can update images, run scripts, or install OOS packages on ECS instances that are in the In Service state.
For more information, see How Auto Scaling works.
Auto Scaling provides a variety of scaling features that can be used in the following business scenarios:
- Scenarios in which workload fluctuations can be predicted. For example, a video production company whose workload fluctuations can be predicted uses Auto Scaling to create scheduled tasks. Auto Scaling automatically adds an ECS instance or elastic container instance to help the company handle traffic spikes that occur at 20:00:00 each Friday.
- Scenarios in which workload fluctuations cannot be predicted. For example, a video production company whose workload fluctuations cannot be predicted uses Auto Scaling to create event-triggered tasks and monitor the CPU utilization of instances. If the CPU utilization exceeds 60%, Auto Scaling automatically adds an ECS instance or elastic container instance to help the company handle traffic spikes.
For more information, see Scenarios.
Auto Scaling is free of charge. However, you are charged for the resources of other services that you use, including ECS, Elastic Container Instance, ApsaraDB RDS, SLB, and Message Service (MNS). For more information, see Billing rules.
How to use Auto Scaling
- Auto Scaling console: a web page that supports interactive operations.
- API: a remote procedure call (RPC) API that supports GET and POST requests. For more information, see List of API operations (2014-08-24). If you want to call the Auto Scaling API, use the following common developer tools:
- Alibaba Cloud CLI: a flexible and scalable management tool based on Alibaba Cloud APIs. You can use CLI to encapsulate Alibaba Cloud native APIs and develop custom features.
- OpenAPI Explorer: a tool that allows you to retrieve API operations, call API operations, and dynamically generate SDK sample code.