Help Center/ Auto Scaling/ Getting Started/ Scaling Your Website Dynamically
Updated on 2026-01-04 GMT+08:00

Scaling Your Website Dynamically

Scenarios

When service requirements change frequently and irregularly, you can configure alarm-based AS policies in your application system to adjust resources dynamically. When the conditions of a policy are met, the system automatically changes the expected number of instances to trigger a scaling action to add or remove instances. This reduces the workload of manual resource adjustments caused by service changes or peak hours, helping you save resource and labor costs.

Assume that you are an e-commerce vendor that runs a website on an ECS. If you plan to launch a big sales promotion at 00:00 on a certain day but the ECS is unable to handle service requests during peak hours, you can address this issue according the guidance of this section.

Procedure

Step

Description

Step 1: Create an AS Configuration

Configure the specifications, image, and disks for new ECS instances.

Step 2: Create an AS Group

Configure the maximum, minimum, and expected number of instances and other parameters.

Step 3: Add an AS Policy

Create an AS policy to adjust service resources.

(Optional) Step 4: Manually Add Instances

Add instances to the AS group when the group is enabled, no scaling action is in progress in it, and the number of instances in it is less than the maximum allowed.

(Optional) Step 5: View Monitoring Data

View monitoring data changes during the scaling action.

Step 1: Create an AS Configuration

In this step, create an AS configuration using the example settings. For more information, see AS Configuration.

  1. Log in to the AS console.
  2. Click Create AS Configuration and set parameters.
    Figure 1 Creating an AS configuration


    Table 1 Parameters for creating an AS configuration

    Parameter

    Example

    Description

    Billing Mode

    Pay-per-use

    Resources will be billed based on the usage duration. You can provision or delete resources at any time. For more information, see Billing Overview.

    Region

    CN-Hong Kong

    For low network latency and fast resource access, select the region nearest to your target users.

    For more information, see Region and AZ.

    Name

    as-config-3817

    Enter a name for the AS configuration.

    Configuration Template

    Create new template

    Configure the specifications, image, disks, and other parameters for the instance.

    CPU Architecture

    x86

    x86 uses Complex Instruction Set Computing (CISC).

    Specifications

    s7n.xlarge.2

    Select a flavor based on service requirements. For more information, see A Summary List of x86 ECS Specifications.

    Image

    CentOS 8.2 64bit(40GiB)

    The example is a free public Linux image provided by Huawei Cloud.

    Disk

    General Purpose SSD, 100 GiB

    This is a system disk that will be created together with an instance. They are used to store the OS of each instance.

    Security Group

    default

    Use the default security group.

    EIP

    Do not use

    If the instances need to access the Internet, you can configure EIPs for them.

    Login Mode

    Key pair

    Set Login Mode to Key pair.

    Key Pair

    KeyPair-2325

    Use an existing or create a new key pair. Ensure that you have obtained the private key.

    Advanced Settings

    Do not configure

    -

  3. Click Create Now.
  4. Click Back to AS Configuration List to view the new AS configuration.
    Figure 2 Viewing an AS configuration

Step 2: Create an AS Group

In this step, create an AS group using the example settings. For more information, see AS Group.

  1. Click Create AS Group and set parameters.
    Figure 3 Creating an AS group


    Table 2 Parameters for creating an AS group

    Parameter

    Example

    Description

    Region

    CN-Hong Kong

    For low network latency and fast resource access, select the region nearest to your target users.

    For more information, see Region and AZ.

    AZ

    AZ1, AZ2, AZ3, AZ7

    AZs are physically isolated but interconnected over an intranet.

    Multi-AZ Scaling Policy

    Balanced

    This policy ensures that the number of instances in each of the selected AZs is balanced.

    Name

    as-group-test1

    Enter a name for the AS group.

    Max. Instances

    1

    Specify the maximum number of instances in the AS group.

    Expected Instances

    0

    Specify the desired number of instances in the AS group.

    Min. Instances

    0

    Specify the minimum number of instances in the AS group.

    AS Configuration

    as-config-3817

    Select the AS configuration created in Step 1: Create an AS Configuration.

    VPC

    vpc-default-smb

    Use the default VPC and subnet.

    For more information, see VPC Network Planning Suggestions.

    Subnet

    subnet-default-smb

    Load Balancing

    Do not use

    This parameter is optional. For more information, see Creating an AS Group.

    Instance Removal Policy

    Oldest instance created from oldest AS configuration

    With this policy, instances that use the oldest AS configuration are removed from the AS group first.

    EIP

    Release

    With this option, when an instance is removed from an AS group, its EIP will be released.

    Data Disk

    Delete

    With this option, when an instance is removed from the AS group, all data disks attached to it will be deleted

    Health Check Method

    ECS health check

    With this method, AS checks whether instances are running. If an instance fails the health check, AS removes it from the AS group.

    Health Check Interval

    5 minutes

    Specify the interval between health checks.

    Health Check Grace Period (s)

    600

    Specify how long AS must wait before checking the health status of an instance after the instance is enabled in an AS group.

    Enterprise Project

    default

    Specify the enterprise project where the AS group is managed. Instances in this AS group are also managed under the same project.

  2. Click Create Now.
  3. Click Back to AS Group List to view the new AS group.
    Figure 4 Viewing an AS group

Step 3: Add an AS Policy

  1. In the AS group list, locate the AS group and click View AS Policy in the Operation column. Then, click Add AS Policy.
  2. Configure the parameters for adding an AS policy.
    Figure 5 Parameters for adding an AS policy
    Table 3 Alarm-based AS policy parameters

    Parameter

    Example

    Description

    Policy Name

    as-policy-e26c

    Enter a name for the AS policy.

    Policy Type

    Alarm

    Set Policy Type to Alarm.

    Alarm Rule

    Create

    You can choose either to create a new alarm rule or use an existing one.

    Rule Name

    as-alarm-43bd

    Enter a name for the alarm rule.

    Monitoring Type

    System monitoring

    You can choose either System monitoring or Custom monitoring.

    Trigger Condition

    CPU Usage Max. > 90%

    -

    Monitoring Interval

    5 minutes

    -

    Consecutive Occurrences

    3

    -

    Enterprise Project

    default

    The default enterprise project is default.

    Alarm Policy Type

    Simplified scaling

    -

    Scaling Action

    Add 2 instances

    Specify an action and the number or percentage of instances.

    The value can be Add, Reduce, or Set to.

    Cooldown Period (s)

    300

    To prevent an alarm-based policy from being repeatedly triggered by the same event, you can set a cooldown period.

  3. Click OK.

(Optional) Step 4: Manually Add Instances

  1. Click the name of the AS group. Click the Instances tab.
  2. Select the instance to be added and click Add.
    Figure 6 Manually adding instances

    Instances can be added to an AS group only when the group is enabled, no scaling action is in progress in it, and the number of instances in it is less than the maximum allowed.

(Optional) Step 5: View Monitoring Data

Click the name of the AS group and then click the Monitoring tab. You can view monitoring data changes of the AS group's scaling actions. AS can monitor CPU status in real time and perform scaling actions based on configured policies. This meets service requirements and reduces costs.

Figure 7 Viewing monitoring data