ALIYUN::ESS::ScalingGroup creates a scaling group, a collection of ECS instances for the same application scenario. The group does not take effect until you enable it with ALIYUN::ESS::ScalingGroupEnable to trigger scaling activities and execute scaling rules.
Syntax
{
"Type": "ALIYUN::ESS::ScalingGroup",
"Properties": {
"MultiAZPolicy": String,
"DesiredCapacity": Integer,
"NotificationConfigurations": List,
"ProtectedInstances": List,
"LaunchTemplateId": String,
"LaunchTemplateVersion": String,
"ScalingGroupName": String,
"VSwitchIds": List,
"DefaultCooldown": Integer,
"MinSize": Integer,
"GroupDeletionProtection": Boolean,
"MaxSize": Integer,
"InstanceId": String,
"VSwitchId": String,
"LoadBalancerIds": List,
"StandbyInstances": List,
"RemovalPolicys": List,
"HealthCheckType": String,
"DBInstanceIds": List,
"Tags": List,
"OnDemandPercentageAboveBaseCapacity": Integer,
"CompensateWithOnDemand": Boolean,
"ContainerGroupId": String,
"ScalingPolicy": String,
"SpotInstanceRemedy": Boolean,
"SpotInstancePools": Integer,
"OnDemandBaseCapacity": Integer,
"GroupType": String,
"LaunchTemplateOverrides": List,
"AllocationStrategy": String,
"AzBalance": Boolean,
"MaxInstanceLifetime": Integer,
"CustomPolicyARN": String,
"SpotAllocationStrategy": String,
"HealthCheckTypes": List,
"ServerGroups": List,
"ResourceGroupId": String
}
}
Properties
|
Property name |
Type |
Required |
Updatable |
Description |
Constraints |
|
MinSize |
Integer |
Yes |
Yes |
The minimum number of ECS instances in the scaling group. |
Valid values: 0 to 1000. Auto Scaling automatically creates instances when the count falls below this value. |
|
MaxSize |
Integer |
Yes |
Yes |
The maximum number of ECS instances in the scaling group. |
Valid values: 0 to 1000. Auto Scaling automatically removes instances when the count exceeds this value. |
|
ScalingGroupName |
String |
No |
Yes |
The display name of the scaling group. |
The name must be 2 to 64 characters in length. It must start with a digit, a letter, or a Chinese character. It can contain letters, Chinese characters, digits, underscores (_), hyphens (-), and periods (.). The name must be unique within the same region and under the same Alibaba Cloud account. Default value: the ID of the scaling group. |
|
LaunchTemplateId |
String |
No |
Yes |
The ID of the launch template used for instance creation. |
None |
|
LaunchTemplateVersion |
String |
No |
Yes |
The version of the ECS launch template. |
Valid values:
|
|
RemovalPolicys |
List |
No |
Yes |
The policies for removing ECS instances from the scaling group. |
Valid values:
|
|
VSwitchId |
String |
No |
Yes |
The ID of the vSwitch. |
None |
|
LoadBalancerIds |
List |
No |
Yes |
The IDs of the SLB instances. |
JSON array of up to five SLB instance IDs, separated by commas (,). |
|
DefaultCooldown |
Integer |
No |
Yes |
The cooldown time after a scaling activity is complete. |
Valid values: 0 to 86,400. Unit: seconds. Default value: 300. During cooldown, the scaling group rejects other scaling activities. Applies only to activities triggered by CloudMonitor event-triggered tasks. |
|
DBInstanceIds |
List |
No |
Yes |
The IDs of the ApsaraDB RDS instances. |
JSON array of up to eight RDS instance IDs, separated by commas (,). |
|
VSwitchIds |
List |
No |
Yes |
The IDs of multiple vSwitches. |
Up to five vSwitch IDs. Overrides VSwitchId when both are specified. vSwitches are prioritized in order; if instance creation fails in a higher-priority zone, the next vSwitch is used. |
|
MultiAZPolicy |
String |
No |
Yes |
The scaling policy for ECS instances in a multi-zone scaling group. |
Valid values:
|
|
NotificationConfigurations |
List |
No |
Yes |
Event and resource change notification configurations. |
|
|
ProtectedInstances |
List |
No |
Yes |
The number of protected ECS instances in the scaling group. |
You can specify up to 1,000 instances. |
|
StandbyInstances |
List |
No |
Yes |
The number of standby ECS instances in the scaling group. |
You can specify up to 1,000 instances. |
|
HealthCheckTypes |
List |
No |
Yes |
Health check types for the scaling group. |
Valid values:
|
|
HealthCheckType |
String |
No |
Yes |
The health check type. |
Valid values:
|
|
GroupDeletionProtection |
Boolean |
No |
Yes |
Enables or disables deletion protection for the scaling group. |
Valid values:
|
|
DesiredCapacity |
Integer |
No |
Yes |
The expected number of ECS instances in the scaling group. Auto Scaling maintains the instance count at this value. |
The value must be greater than or equal to MinSize and less than or equal to MaxSize. |
|
InstanceId |
String |
No |
No |
The ID of an ECS instance from which the system derives a scaling configuration during group creation. |
None |
|
Tags |
List |
No |
Yes |
The tags. |
You can add up to 20 tags. |
|
OnDemandPercentageAboveBaseCapacity |
Integer |
No |
Yes |
The percentage of on-demand instances among the instances that exceed the base capacity. |
After meeting OnDemandBaseCapacity, this percentage applies to additional instances beyond the base. Valid values: 0 to 100. |
|
CompensateWithOnDemand |
Boolean |
No |
Yes |
Whether to create on-demand instances to meet the required ECS instance count. |
Effective only when MultiAZPolicy is COST_OPTIMIZED. Creates on-demand instances when spot instances are unavailable due to price or inventory constraints. Valid values:
|
|
ContainerGroupId |
String |
No |
No |
The ID of the ECI instance. |
None |
|
ScalingPolicy |
String |
No |
No |
The reclamation mode of the scaling group. |
Valid values:
ScalingPolicy sets the reclamation mode. The actual removal behavior is determined by the RemovePolicy parameter of RemoveInstances. |
|
SpotInstanceRemedy |
Boolean |
No |
Yes |
Enables supplemental spot instances. |
Valid values:
|
|
SpotInstancePools |
Integer |
No |
Yes |
The number of available instance types. |
The scaling group balances spot instances across the lowest-cost instance types. Valid values: 1 to 10. |
|
OnDemandBaseCapacity |
Integer |
No |
Yes |
The minimum number of on-demand instances required by the scaling group. |
Valid values: 0 to 1000. The system prioritizes on-demand instance creation when the count is below this value. |
|
GroupType |
String |
No |
No |
The type of instances managed by the scaling group. |
Valid values:
|
|
LaunchTemplateOverrides |
List |
No |
Yes |
Instance type overrides that extend the launch template. |
None |
|
AllocationStrategy |
String |
No |
Yes |
The capacity allocation policy. |
Determines how the scaling group selects instance types to meet capacity requirements. Applies to both on-demand and preemptible capacity. Effective only when Valid values:
|
|
AzBalance |
Boolean |
No |
Yes |
Evenly distributes the scaling group capacity across multiple zones. |
Effective only when Valid values:
|
|
MaxInstanceLifetime |
Integer |
No |
Yes |
The maximum lifetime of an instance in the scaling group. |
Unit: seconds. Valid values: 86400 to Default value: null. |
|
CustomPolicyARN |
String |
No |
Yes |
The ARN of the custom scale-in policy function. |
This parameter is effective only when the first removal policy in RemovalPolicies is set to CustomPolicy. |
|
SpotAllocationStrategy |
String |
No |
Yes |
The allocation policy for spot capacity. |
Distribution strategy for spot capacity. Effective only when Valid values:
|
|
ServerGroups |
List |
No |
No |
Server Load Balancer server group configurations. |
|
|
ResourceGroupId |
String |
No |
Yes |
The ID of the resource group. |
None |
ServerGroups syntax
"ServerGroups": [
{
"Type": String,
"ServerGroupId": String,
"Weight": Number,
"Port": Number
}
]
ServerGroups properties
|
Property name |
Type |
Required |
Updatable |
Description |
Constraints |
|
Type |
String |
Yes |
No |
The Server Load Balancer server group type. |
Valid values:
|
|
ServerGroupId |
String |
Yes |
No |
The Server Load Balancer server group ID. |
None |
|
Weight |
Number |
Yes |
No |
The weight of the ECS or ECI instance as a backend server. |
Valid values: 0 to 100. A higher weight means more requests are routed to the instance. A weight of 0 means the instance receives no requests. |
|
Port |
Number |
Yes |
No |
The port number of the backend ECS or ECI instance. |
Valid values: 1 to 65535. |
NotificationConfigurations syntax
"NotificationConfigurations": [
{
"NotificationArn": String,
"NotificationTypes": List
}
]
NotificationConfigurations properties
|
Property name |
Type |
Required |
Updatable |
Description |
Constraints |
|
NotificationArn |
String |
Yes |
No |
The notification recipient for lifecycle hooks. Supports Simple Message Queue (formerly MNS) queues or topics. |
Valid values:
|
|
NotificationTypes |
List |
Yes |
No |
Notification types for Auto Scaling events and resource changes. |
None |
Tags syntax
"Tags": [
{
"Key": String,
"Value": String
}
]
Tags properties
|
Property name |
Type |
Required |
Updatable |
Description |
Constraints |
|
Key |
String |
Yes |
No |
The tag key. |
The key must be 1 to 128 characters in length. It cannot start with |
|
Value |
String |
No |
No |
The tag value. |
The value can be 0 to 128 characters in length. It cannot start with |
LaunchTemplateOverrides syntax
"LaunchTemplateOverrides": [
{
"InstanceType": String,
"WeightedCapacity": Integer,
"SpotPriceLimit": Number
}
]
LaunchTemplateOverrides properties
|
Property name |
Type |
Required |
Updatable |
Description |
Constraints |
|
InstanceType |
String |
No |
Yes |
The ECS instance type. |
To scale based on instance type capacity, specify both this parameter and Overwrites the instance type in the launch template. Note
This parameter is effective only when a launch template is specified by the LaunchTemplateId parameter. |
|
WeightedCapacity |
Integer |
No |
Yes |
The weight of the instance type. |
To scale based on instance type capacity, specify Represents the capacity of a single instance of this type. A higher weight means fewer instances are needed to meet the expected capacity. Set weights based on performance metrics such as vCPU count and memory size. For example:
To meet the expected capacity, the scaling group will scale out two Valid values: 1 to 500. Note
During a scale-out, the scaling group capacity cannot exceed MaxSize plus the maximum weight of a single instance type. |
|
SpotPriceLimit |
Number |
No |
Yes |
The maximum price for a spot instance. |
Maximum price for a spot instance of the type specified by Note
This parameter is effective only when a launch template is specified by the |
Return value
Fn::GetAtt
-
ScalingGroupId: The ID of the scaling group.
-
ScalingGroupName: The name of the scaling group.
-
Arn: The Alibaba Cloud Resource Name (ARN).
Examples
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
VSwitch:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
Type: String
Label:
zh-cn: VSwitch ID
en: VSwitch ID
LaunchTemplateId:
AssociationProperty: ALIYUN::ECS::LaunchTemplate::LaunchTemplateId
Type: String
Resources:
ScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
Properties:
VSwitchId:
Ref: VSwitch
LaunchTemplateId:
Ref: LaunchTemplateId
MaxSize: 3
ScalingGroupName: TestScalingGroup
MinSize: 0
Outputs:
ScalingGroupId:
Description: The ID of the scaling group.
Value:
Fn::GetAtt:
- ScalingGroup
- ScalingGroupId
ScalingGroupName:
Description: The name of the scaling group.
Value:
Fn::GetAtt:
- ScalingGroup
- ScalingGroupName{
"ROSTemplateFormatVersion": "2015-09-01",
"Parameters": {
"VSwitch": {
"AssociationProperty": "ALIYUN::ECS::VSwitch::VSwitchId",
"Type": "String",
"Label": {
"zh-cn": "VSwitch ID",
"en": "VSwitch ID"
}
},
"LaunchTemplateId":{
"AssociationProperty":"ALIYUN::ECS::LaunchTemplate::LaunchTemplateId",
"Type":"String"
}
},
"Resources": {
"ScalingGroup": {
"Type": "ALIYUN::ESS::ScalingGroup",
"Properties": {
"VSwitchId": {
"Ref": "VSwitch"
},
"LaunchTemplateId": {
"Ref": "LaunchTemplateId"
},
"MaxSize": 3,
"ScalingGroupName": "TestScalingGroup",
"MinSize": 0
}
}
},
"Outputs": {
"ScalingGroupId": {
"Description": "The ID of the scaling group.",
"Value": {
"Fn::GetAtt": [
"ScalingGroup",
"ScalingGroupId"
]
}
},
"ScalingGroupName": {
"Description": "The name of the scaling group.",
"Value": {
"Fn::GetAtt": [
"ScalingGroup",
"ScalingGroupName"
]
}
}
}
}When a scaling group has only one scaling configuration that depends on other resources, set DependsOn on the scaling group to create the required resource dependency.
In this example, ScalingGroup depends on SecurityGroup because ScalingConfiguration requires it.
ROSTemplateFormatVersion: '2015-09-01'
Parameters:
VpcId:
AssociationProperty: ALIYUN::ECS::VPC::VPCId
Type: String
VSwitchId:
AssociationProperty: ALIYUN::ECS::VSwitch::VSwitchId
Type: String
AssociationPropertyMetadata:
VpcId: ${VpcId}
Resources:
ScalingGroupEnable:
Type: ALIYUN::ESS::ScalingGroupEnable
Properties:
ScalingConfigurationId:
Ref: ScalingConfiguration
ScalingGroupId:
Ref: ScalingGroup
ScalingRuleArisExecuteVersion: 0
SecurityGroup:
Type: ALIYUN::ECS::SecurityGroup
Properties:
SecurityGroupName:
Ref: ALIYUN::StackName
VpcId:
Ref: VpcId
SecurityGroupIngress:
- PortRange: '-1/-1'
Priority: 1
SourceCidrIp: 0.0.X.X/0
IpProtocol: all
NicType: internet
SecurityGroupEgress:
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
DestCidrIp: 0.0.X.X/0
NicType: internet
- PortRange: '-1/-1'
Priority: 1
IpProtocol: all
DestCidrIp: 0.0.X.X/0
NicType: intranet
ScalingConfiguration:
Type: ALIYUN::ESS::ScalingConfiguration
DependsOn: ScalingGroup
Properties:
InstanceType: ecs.g6e.large
ImageId: centos_7_04_64_20G_alibase_201701015.vhd
SystemDiskCategory: cloud_essd
SystemDiskSize: 100
ScalingConfigurationName:
Ref: ALIYUN::StackName
ScalingGroupId:
Ref: ScalingGroup
SecurityGroupId:
Ref: SecurityGroup
ScalingGroup:
Type: ALIYUN::ESS::ScalingGroup
DependsOn: SecurityGroup
Properties:
MaxSize: 3
MinSize: 0
DefaultCooldown: 15
VSwitchId:
Ref: VSwitchId
Outputs: {}