Using AS to Dynamically Add ECSs
Auto Scaling (AS) automatically adjusts computing resources based on service requirements and configured policies.
You can specify AS configurations and policies based on service requirements. These configurations and policies free you from having to repeatedly adjust resources to keep up with service changes and demand spikes, and help you reduce the resources and manpower required.
An e-Commerce website runs on an ECS (ecs-c9b4) on HUAWEI CLOUD. The website plans to initiate a discount marketing campaign at 00:00 on a certain day. To respond to the demand spike during the campaign, the website can take the following measures:
Step 1: Create an AS Configuration
1. Log in to the management console.
2. Choose Service List > Computing > Auto Scaling.
3. Click Create AS Configuration.
4. Configure the parameters and click Create Now.
1. Select Use specifications of an existing ECS for Configuration Template and select ECS ecs-c9b4.
2. Select Key pair or Password for Login Mode. Key pair is selected in the given example.
3. Advanced Settings is optional. You can configure file injection or user data injection.
Configuring AS configuration parameters
Step 2: Create an AS Group
1. On the Instance Scaling page, click Create AS Group.
2. Configure the parameters and click Next.
1. Set Min. Instances and Expected Instances to 0 and Max. Instances to 10.
2. Select the AZ where ecs-c9b4 resides for AZ.
3. Select the VPC where ecs-c9b4 resides for VPC.
4. Select Elastic load balancer for Load Balancing. Access traffic will be automatically distributed to all ECSs in the AS group.
5. Select ECS health check or ELB health check for Health Check Method. ECS health check is selected in the given example.
Configuring AS group parameters (part 1)
Configuring AS group parameters (part 2)
Step 3: Add an AS Configuration
1. Select AS configuration as-config-ttvm for AS group as-group-9n8i.
2. Click Create Now.
1. The preceding operations use Use existing as an example. You can also select Create to create an AS configuration.
2. After the AS group is created, you can change the AS configuration as you need.
Adding an AS configuration for an AS group
Step 4: Add an AS Policy
1. On the AS Groups page, locate the created AS group and click View AS Policy.
2. Click Add to add an AS policy for AS group as-group-9n8i.
You can also click the AS group name, click the AS Policies tab, and then click Add.
Viewing the AS policy
Adding an AS policy
Step 5: Configure AS Policy Parameters
1. Select Alarm for Policy Type.
2. Set Trigger Condition to CPU Usage Max. > 90%.
3. Set Scaling Action to Add 2 instances.
4. Retain the default value of Cooldown Period.
5. After configuring the parameters, click OK.
Configuring AS policy parameters
Step 6: Manually Add Instances
1. Click the name of the target AS group and click the Instances tab.
2. Select the instances to be added and click Add.
You can add instances to an AS group only if the AS group is enabled and has no ongoing scaling action, and the number of instances is less than the maximum number of instances.
Adding instances to an AS group
Step 7: View Monitoring Data
View monitoring data of the scaling actions of AS group as-group-9n8i. The figure on the right suggests that:
1. The AS group contains no instance after it was created. After Expected Instances was changed to 2, a scaling action was triggered and two ECSs were added to the AS group.
2. The CPU usage stays stable.
AS monitors CPU status in real time and performs scaling actions based on the configured policy to meet service requirements and reduce costs.
Viewing monitoring data