This topic describes how to use Auto Scaling to evenly distribute ECS instances across zones and deploy a high-availability compute cluster at lower 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 compute resources. This results in higher costs and may face scalability problems, such as insufficient resources, insufficient time to manually create ECS instances, and service disruption. All these problems pose risks to the business.

You can adopt the solutions provided in this topic if your application is applicable to the following scenarios:
  • Distributed big data computing
  • Artificial intelligence 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 the high availability of the compute cluster.

You can adopt the following solutions:
  • Use Auto Scaling to distribute compute nodes across multiple zones and specify multiple instance types.
  • 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 maintenance cost

    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 for RDS instance. When the load decreases, the scaling group automatically removes ECS instances from the whitelist of the ApsaraDB for RDS instance, and then releases the instances. The whole process is automatically triggered and completed without the need for manual intervention.

  • High cost-effectiveness

    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 in a zone 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 application requirements.

  1. Log on to the Auto Scaling console.
  2. In the top navigation bar, select a region.
  3. Create a scaling group.
    • Set Source Type to Create from Scratch.
    • Set Minimum Number of Instances to 100.
    • Set Network Type to VPC.
    • Select VSwitches across multiple zones.
    • Set Multi-zone Scaling Policy to Balanced Distribution Policy.
    • Bind the ApsaraDB for RDS instances used by your current business modules.

    Configure other parameters based on your needs. For more information, see Create a scaling group.

  4. Click View Scaling Group Details.
  5. Go to the Instance Configuration Source page to create a scaling configuration.
    • Set Billing Method to Preemptible Instance.
    • Set Image to your custom image.

    Configure other parameters based on your needs. For more information, see Create a scaling configuration.

  6. 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 the application when a zone has insufficient resources. The scaling group automatically creates new preemptible instances after the previous preemptible instances are reclaimed. Additionally, the scaling group automatically removes unhealthy ECS instances and creates new ECS instances. This ensures the high availability of clusters and also reduces costs.