Professional Documents
Culture Documents
Auto Scaling
Quick Start
Issue: 20200515
Auto Scaling Quick Start / Legal disclaimer
Legal disclaimer
Alibaba Cloud reminds you to carefully read and fully understand the terms and conditions
of this legal disclaimer before you read or use this document. If you have read or used this
document, it shall be deemed as your total acceptance of this legal disclaimer.
1. You shall download and obtain this document from the Alibaba Cloud website or other
Alibaba Cloud-authorized channels, and use this document for your own legal business
activities only. The content of this document is considered confidential information of
Alibaba Cloud. You shall strictly abide by the confidentiality obligations. No part of this
document shall be disclosed or provided to any third party for use without the prior
written consent of Alibaba Cloud.
3. The content of this document may be changed due to product version upgrades,
adjustments, or other reasons. Alibaba Cloud reserves the right to modify the content
of this document without notice and the updated versions of this document will be
occasionally released through Alibaba Cloud-authorized channels. You shall pay
attention to the version changes of this document as they occur and download and
obtain the most up-to-date version of this document from Alibaba Cloud-authorized
channels.
4. This document serves only as a reference guide for your use of Alibaba Cloud products
and services. Alibaba Cloud provides the document in the context that Alibaba Cloud
products and services are provided on an "as is", "with all faults" and "as available"
basis. Alibaba Cloud makes every effort to provide relevant operational guidance based
on existing technologies. However, Alibaba Cloud hereby makes a clear statement that it
in no way guarantees the accuracy, integrity, applicability, and reliability of the content
of this document, either explicitly or implicitly. Alibaba Cloud shall not bear any liability
for any errors or financial losses incurred by any organizations, companies, or individual
s arising from their download, use, or trust in this document. Alibaba Cloud shall not,
under any circumstances, bear responsibility for any indirect, consequential, exemplary
, incidental, special, or punitive damages, including lost profits arising from the use or
trust in this document, even if Alibaba Cloud has been notified of the possibility of such
a loss.
Issue: 20200515 I
Auto Scaling Quick Start / Legal disclaimer
5. By law, all the contents in Alibaba Cloud documents, including but not limited to
pictures, architecture design, page layout, and text description, are intellectual property
of Alibaba Cloud and/or its affiliates. This intellectual property includes, but is not
limited to, trademark rights, patent rights, copyrights, and trade secrets. No part of
this document shall be used, modified, reproduced, publicly transmitted, changed,
disseminated, distributed, or published without the prior written consent of Alibaba
Cloud and/or its affiliates. The names owned by Alibaba Cloud shall not be used,
published, or reproduced for marketing, advertising, promotion, or other purposes
without the prior written consent of Alibaba Cloud. The names owned by Alibaba Cloud
include, but are not limited to, "Alibaba Cloud", "Aliyun", "HiChina", and other brands
of Alibaba Cloud and/or its affiliates, which appear separately or in combination, as
well as the auxiliary signs and patterns of the preceding brands, or anything similar
to the company names, trade names, trademarks, product or service names, domain
names, patterns, logos, marks, signs, or special descriptions that third parties identify as
Alibaba Cloud and/or its affiliates.
6. Please contact Alibaba Cloud directly if you discover any errors in this document.
II Issue: 20200515
Auto Scaling Quick Start / Legal disclaimer
Document conventions
Style Description Example
> Closing angle brackets are used Click Settings > Network > Set
to indicate a multi-level menu network type.
cascade.
Courier font Courier font is used for commands. Run the cd /d C:/window
command to enter the Windows
system folder.
Issue: 20200515 I
Auto Scaling Quick Start / Document conventions
II Issue: 20200515
Auto Scaling Quick Start / Document conventions
Contents
Legal disclaimer......................................................................... I
Document conventions................................................................I
1 Operation procedure............................................................... 1
2 Activate and grant permissions to Auto Scaling........................ 2
3 Create a scaling group and a scaling configuration................... 7
4 Automatically add ECS instances............................................11
5 Automatically remove ECS instances...................................... 13
IV Issue: 20200515
Auto Scaling Quick Start / 1 Operation procedure
1 Operation procedure
This topic introduces the steps to create a complete Auto Scaling solution.
3. Enable the scaling group with the scaling configuration created in Step 2
(EnableScalingGroup).
5. Create a scheduled task (CreateScheduledTask). For example, to trigger the scaling rule
created in Step 4 at 12:00 AM.
6. Create an alarm task (CloudMonitor API PutAlarmRule). For example, to add 1 ECS
instance when the average (it can also be max or min) CPU usage is greater than or
equal to 80%.
Issue: 20200515 1
Auto Scaling Quick Start / 2 Activate and grant permissions to Auto
Scaling
Context
You must activate Auto Scaling and grant necessary permissions to Auto Scaling when you
use Auto Scaling for the first time. If you have used Auto Scaling before, skip this topic to
create a scaling group and a scaling configuration. For more information, see Create a
scaling group and a scaling configuration.
3. Select I agree with Auto Scaling Agreement of Service and click Enable Now.
2. Click Authorize.
2 Issue: 20200515
Auto Scaling Quick Start / 2 Activate and grant permissions to Auto
Scaling
3. On the page that appears, select AliyunESSDefaultRole and click Confirm Authorization
Policy.
The Resource Access Management (RAM) role AliyunESSDefaultRole has the permissions
specified in the AliyunESSRolePolicy policy. The content of the AliyunESSRolePolicy policy
is updated from time to time. You can go to the RAM console to view the latest content of
the policy. For more information, see #unique_6. Currently, the policy is as follows:
{
"Version": "1",
"Statement": [
{
"Action": [
"ecs:CreateInstance",
"ecs:RunInstances",
"ecs:StartInstance",
"ecs:AllocatePublicIpAddress",
"ecs:StopInstance",
"ecs:DeleteInstance",
"ecs:DescribeInstances",
"ecs:DescribeInstanceAttribute",
"ecs:ModifyInstanceAttribute",
"ecs:DescribeSecurityGroupAttribute",
"ecs:DescribeImages",
"ecs:DescribeSnapshots",
"ecs:DescribeKeyPairs",
"slb:DescribeLoadBalancerAttribute",
"slb:RemoveBackendServers",
"slb:DescribeHealthStatus",
"slb:AddBackendServers",
"slb:SetBackendServers",
"rds:ModifySecurityIps",
"rds:DescribeDBInstanceAttribute",
"rds:DescribeTaskInfo",
"rds:DescribeDBInstanceIPArrayList"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": [
"vpc:DescribeVpcs",
"vpc:DescribeVSwitches"
],
"Resource": "*",
Issue: 20200515 3
Auto Scaling Quick Start / 2 Activate and grant permissions to Auto
Scaling
"Effect": "Allow"
},
{
"Action": [
"mns:ListTopic",
"mns:ListQueue",
"mns:SendMessage",
"mns:PublishMessage"
],
"Resource": "*",
"Effect": "Allow"
},
{
"Action": "ram:PassRole",
"Resource": "*",
"Effect": "Allow",
"Condition": {
"StringEquals": {
"acs:Service": "ecs.aliyuncs.com"
}
}
}
]
}
For more information about each action, see the API documentation of the
corresponding service. For example, the ecs:RunInstances action allows Auto Scaling to
create one or more Elastic Compute Service (ECS) instances. For more information, see
#unique_7.
• ECS-related actions
Action Description
4 Issue: 20200515
Auto Scaling Quick Start / 2 Activate and grant permissions to Auto
Scaling
Action Description
• SLB-related actions
Action Description
• RDS-related actions
Action Description
• VPC-related actions
Action Description
• MNS-related actions
Action Description
Issue: 20200515 5
Auto Scaling Quick Start / 2 Activate and grant permissions to Auto
Scaling
Action Description
What's next
After you activate and grant permissions to Auto Scaling, you can create a scaling group
and a scaling configuration. For more information, see Create a scaling group and a scaling
configuration.
6 Issue: 20200515
Auto Scaling Quick Start / 3 Create a scaling group and a scaling
configuration
Prerequisites
A security group is created. For more information, see #unique_8.
Note:
The security group and the scaling group must be in the same region.
Context
To use Auto Scaling, you must create a scaling group at first. A scaling group is a group
of Elastic Compute Service (ECS) instances that provide the same service. A scaling
configuration is a template used by a scaling group to create ECS instances. After a scaling
group is created, its region cannot be changed. For more information, see #unique_9.
This topic describes how to create a scaling group, create a scaling configuration for the
scaling group, and enable the scaling group. The minimum number of ECS instances in the
scaling group is set to 1.
In this example, a scaling group is created with simple settings. For more information about
the parameters, see #unique_10.
Issue: 20200515 7
Auto Scaling Quick Start / 3 Create a scaling group and a scaling
configuration
A removal policy contains two levels of priorities. In this example, set the level-1
priority to Earliest Instance Created Using Scaling Configuration and the level-2
priority to Earliest Created Instance.
f) Select a configuration source for creating ECS instances in the scaling group.
In this example, select Custom Scaling Configuration. If you select Launch Template,
the scaling group can be enabled immediately after it is created. Make sure that a
launch template is created in ECS in advance.
In this example, select Classic. If you select VPC, you can set the multi-zone scaling
policy and reclaim mode to scale ECS instances more flexibly. However, you must
create a Virtual Private Cloud (VPC) and a VSwitch in Alibaba Cloud VPC in advance.
For more information, see #unique_11 and #unique_12.
5. Click OK.
Alternatively, click Create Now. You are redirected to the page for configuring basic
settings of a scaling configuration, as described in Step 2: Create a scaling configuration
and enable the scaling group.
In this example, a scaling configuration is created with simple settings. For more
information about the parameters, see #unique_13.
8 Issue: 20200515
Auto Scaling Quick Start / 3 Create a scaling group and a scaling
configuration
3. You can use either of the following methods to open the details page of a scaling group.
Notice:
You can activate and use Auto Scaling for free. However, if Auto Scaling creates ECS
instances or you add existing ECS instances to scaling groups, you must pay for such
ECS instances based on the ECS pricing. For more information, see #unique_14.
c) Select an image.
In this example, select a 40 GiB ultra disk as the system disk but select no data disk.
e) Select a billing method and set the peak value for the public bandwidth.
In this example, select the pay-by-traffic method and set the peak value to 1 Mbit/s.
10.In the Apply Scaling Configuration dialog box that appears, click OK.
11.In the Enable Scaling Group dialog box that appears, click OK.
Result
The minimum number of ECS instances in the scaling group is 1. Therefore, Auto Scaling
automatically creates an ECS instance for the scaling group after it is enabled. You can
Issue: 20200515 9
Auto Scaling Quick Start / 3 Create a scaling group and a scaling
configuration
view the ECS instance in the ECS instance list. For more information, see #unique_15.
The automatically created ECS instance applies configurations specified in the scaling
configuration.
What's next
After the scaling group is enabled, you can create scaling rules for the scaling group and
create scheduled tasks and monitoring tasks to automatically scale ECS instances in the
scaling group. For more information, see the following topics:
• #unique_16
• #unique_17
• #unique_18
10 Issue: 20200515
Auto Scaling Quick Start / 4 Automatically add ECS instances
Prerequisites
A scaling group and a scaling configuration are created.
Context
This example uses the scaling group MyFirstScalingGroup and scaling configuration
MyFirstScalingConfiguration created in Create a scaling group and a scaling configuration
to show how ECS instances are automatically added. The scaling group already has one
ECS instance.
You can also use scheduled tasks to automatically remove ECS instances. For more
information, see #unique_17.
2. You can use either of the following methods to open the details page of a scaling group.
1. In the left-side navigation pane, choose Scaling Tasks > Scheduled Tasks.
Issue: 20200515 11
Auto Scaling Quick Start / 4 Automatically add ECS instances
In this example, specify the time as five minutes later than the current time. Example:
2019-11-11 16:35.
In this example, select the scaling rule Add2 that is created in step 1.
4. Click OK.
Result
When the time reaches 2019-11-11 16:35, the scheduled task ScheduledScalingOut
automatically executes the scaling rule Add2 to add two ECS instances to the scaling group
MyFirstScalingGroup. For more information, go to the Scaling Activities page.
12 Issue: 20200515
Auto Scaling Quick Start / 5 Automatically remove ECS instances
Prerequisites
A scaling group and a scaling configuration are created.
Context
This example uses the scaling group MyFirstScalingGroup created in Create a scaling group
and a scaling configuration to show how ECS instances are automatically removed. After
Auto Scaling adds ECS instances as described in Automatically add ECS instances, the
scaling group has three ECS instances.
You can also monitor other metrics to add ECS instances by using event-triggered tasks
based on your needs. For more information, see #unique_18.
2. You can use either of the following methods to open the details page of a scaling group.
Issue: 20200515 13
Auto Scaling Quick Start / 5 Automatically remove ECS instances
1. In the left-side navigation pane, choose Scaling Tasks > Event-Triggered tasks.
In this example, enter "Remove ECS instances when the average CPU utilization is less
than 10%."
h) Select the number of times when the condition is met before an alert is triggered.
In this example, select the scaling rule To1 that is created in step 1.
4. Click OK.
Result
The event-triggered task EventTriggeredScalingIn monitors the average CPU utilization of
the three ECS instances in the scaling group MyFirstScalingGroup. The monitoring metric
is calculated once every one minute. If the average CPU utilization is less than or equal to
10% for five times, an alert is triggered. The event-triggered task EventTriggeredScalingIn
automatically executes the scaling rule To1 to adjust the number of ECS instances in the
scaling group MyFirstScalingGroup to one. For more information, go to the Scaling Activities
page.
14 Issue: 20200515
Auto Scaling Quick Start / 5 Automatically remove ECS instances
Issue: 20200515 15