This topic describes how to use Auto Scaling to evenly distribute Elastic Compute Service (ECS) instances across zones and deploy a high-availability compute cluster at low costs by using preemptible ECS instances.

Prerequisites

Scenarios

An online advertising provider uses machine learning to implement targeted advertising. During peak hours, the provider requires a large number of temporary compute resources, which may lead to higher costs. Furthermore, scalability issues, such as insufficient resources, insufficient time to manually create ECS instances, and service interruption may occur. All these problems pose risks to the business.

You can adopt the solutions provided in this topic if your application is used in the following scenarios:
  • Distributed big data computing
  • AI training

Solutions

Auto Scaling can provision a compute cluster in a short amount of time. The balanced distribution policy allows you to automatically distribute compute nodes across multiple zones. Auto Scaling also performs health checks on ECS instances to ensure high availability of the compute cluster.

This solution involves the following operations:
  • Use Auto Scaling to distribute compute nodes across multiple zones. Specify multiple instance types to increase the success rate of the solution.
  • Purchase preemptible ECS instances to reduce costs.

Benefits

Auto Scaling enables you to deploy a high-availability compute cluster and offers the following benefits:
  • Zero O&M costs

    You can configure the scaling policy in advance. When the load increases, the scaling group automatically creates and adds ECS instances to the whitelist of the ApsaraDB RDS instance. When the load decreases, the scaling group automatically removes ECS instances from the whitelist of the ApsaraDB RDS instance, and then releases the instances. The whole process is automatically triggered and completed without manual intervention.

  • Highly cost-effective

    Auto Scaling supports preemptible ECS instances. You can purchase preemptible instances at up to 90% discount.

  • High availability

    Auto Scaling uses the balanced distribution policy to automatically distribute and deploy compute nodes across zones. This ensures service availability and reduces the risk that resources fail to be created in a zone where the inventory for a particular resource may be insufficient. Auto Scaling automatically performs health checks to ensure the availability of ECS instances in a scaling group.

Procedure

Evaluate business modules based on your business architecture and create scaling groups for the business modules that require high-availability clusters. Select a custom image for the scaling configuration to ensure that the automatically created ECS instances meet the requirements for your applications.

  1. Log on to the Auto Scaling console.
  2. In the top navigation bar, select the region where Auto Scaling is activated.
  3. Create a scaling group.
    • Set Instance Configuration Source to Create from Scratch.
    • Set Minimum Number of Instances to 100.
    • Set Network Type to VPC.
    • Select vSwitches across multiple zones.
    • Set Expansion and Contraction Strategy to Balanced Distribution Policy.
    • Bind the ApsaraDB RDS instances used by your business modules.

    Configure other parameters as required. For more information, see Manage scaling groups.

  4. On the Scaling Groups page, find the newly created scaling group and go to the scaling group details page.
    • Click the ID of the scaling group in the Scaling Group Name/ID column.
    • Click Details in the Actions column.
  5. In the upper part of the page, click the Instance Configuration Sources tab.
  6. Create a scaling configuration.
    • Set Billing Method to Preemptible Instance.
    • Set Image to Custom Image and select an image.

    Configure other parameters as required. For more information, see Create scaling configurations for scaling groups that contain ECS instances.

  7. Enable the scaling configuration and scaling group.

Result

After the scaling group is enabled, the scaling group automatically distributes 100 ECS instances evenly across the selected zones. This can reduce impacts on applications when a zone has insufficient resources. The scaling group automatically creates new preemptible instances after the previous preemptible instances are reclaimed. The scaling group automatically removes unhealthy ECS instances and creates new ECS instances to replace the unhealthy ECS instances. This ensures high availability of clusters and also reduces costs.