Scaling Your Website Dynamically
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.
Assume that your e-Commerce website runs on ECS ecs-c9b4 in Huawei Cloud. You plan to launch a big promotion at 00:00 on a certain day. To respond to the demand spike during the activity, you 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. Set Use existing ECS to Configuration Template and select ECS ecs-c9b4.
2. Specify Login Mode. In this practice, Key pair is selected.
3. Advanced Settings is optional. You can inject user data as text or file.
Visiting Auto Scaling
Creating an AS configuration
Step 2: Create an AS Group
1. On the Instance Scaling page, click Create AS Group.
2. Configure the parameters and click Now.
1. Select the AZ where ECS ecs-c9b4 resides for AZ.
2.Set Min. Instances and Expected Instances to 0 and Max. Instances to 10.
3. Select the AS configuration you created for AS Configuration.
4. Select the VPC where ECS ecs-c9b4 resides for VPC.
5. Select Elastic load balancer for Load Balancing. Access traffic will be automatically distributed to all availableECSs in the AS group.
6. Select ECS health check for Health Check Method.
Creating an AS group (1)
Creating an AS group (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 3: Add an AS Policy
1. On the AS Groups page, locate the created AS group, and click View AS Policy.
2. Click Add AS Policy to add an AS policy for the AS group.
You can also click the AS group name, click the AS Policies tab, and then click Add AS Policy.
Viewing the AS policy
Adding an AS policy
Step 4: 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. Click OK.
Configuring AS policy parameters
Step 5: Manually Add Instances
1. Click the name of the target AS group and click the Instances tab.
2. Click Add, select the instances to be added, and click OK.
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.
Manually adding instances to an AS group
Step 6: View Monitoring Data
View monitoring data of the AS group. 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.
The system monitors CPU usage in real time and performs scaling actions based on the monitoring data and configured policy to meet service requirements and reduce costs.
Viewing monitoring data
Was this page helpful?Provide feedback
For any further questions, feel free to contact us through the chatbot.Chatbot