Queries instances in a scaling group. You can call the DescribeScalingInstances operation to query instance details, such as the number of preemptible instances in the Running state, the number of Elastic Compute Service (ECS) instances, the warm-up status of ECS instances, and the lifecycle status of ECS instances in a scaling group. You can specify the scaling group whose instances you want to query by scaling group ID. If you want to filter instances based on conditions, such as the instance health status, lifecycle status, or creation method, you can also call this operation.
Debugging
Authorization information
The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action
policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:
- Operation: the value that you can use in the Action element to specify the operation on a resource.
- Access level: the access level of each operation. The levels are read, write, and list.
- Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
- The required resource types are displayed in bold characters.
- If the permissions cannot be granted at the resource level,
All Resources
is used in the Resource type column of the operation.
- Condition Key: the condition key that is defined by the cloud service.
- Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
Operation | Access level | Resource type | Condition key | Associated operation |
---|---|---|---|---|
ess:DescribeScalingInstances | get | *ScalingGroup acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId} |
| none |
Request parameters
Parameter | Type | Required | Description | Example |
---|---|---|---|---|
RegionId | string | Yes | The region ID of the scaling group. | cn-hangzhou |
ScalingGroupId | string | No | The ID of the scaling group. | asg-bp1igpak5ft1flyp**** |
ScalingConfigurationId | string | No | The ID of the scaling configuration. | asc-bp1i65jd06v04vdh**** |
HealthStatus | string | No | The health status of the ECS instance in the scaling group. If an ECS instance is not in the Running state, the instance is considered unhealthy. Valid values:
Auto Scaling automatically removes unhealthy ECS instances from the scaling group and then releases the automatically created instances among the unhealthy instances. Unhealthy ECS instances that are manually added to the scaling group are released based on the management mode of the lifecycles of the instances. If the lifecycles of the ECS instances are not managed by the scaling group, Auto Scaling removes the instances from the scaling group but does not release the instances. If the lifecycles of the ECS instances are managed by the scaling group, Auto Scaling removes the instances from the scaling group and releases the instances. Note
Make sure that you have sufficient balance within your Alibaba Cloud account. If your Alibaba Cloud account has an overdue payment, all pay-as-you-go ECS instances, including preemptible instances, may be stopped or even released. For information about how the status of ECS instances changes when you have an overdue payment in your Alibaba Cloud account, see Overdue payments.
| Healthy |
LifecycleState | string | No | The lifecycle status of the ECS instance in the scaling group. Valid values:
| InService |
CreationType | string | No | The instance creation method. Valid values:
| AutoCreated |
PageNumber | integer | No | The page number. Pages start from page 1. Default value: 1. | 1 |
PageSize | integer | No | The number of entries per page. Maximum value: 100. Default value: 10. | 10 |
ScalingActivityId | string | No | The ID of the scaling activity. | asa-bp1c9djwrgxjyk31**** |
InstanceIds | array | No | The IDs of the ECS instances. The IDs of inactive instances are not displayed in the query result, and no errors are returned. | |
string | No | The ID of the ECS instance. The IDs of inactive instances are not displayed in the query result, and no errors are returned. | i-bp109k5j3dum1ce6**** | |
CreationTypes | array | No | The instance creation methods. If you specify this parameter, you cannot specify CreationType. | |
string | No | The instance creation method. You can set the value to AutoCreated, Attached, or Managed. | AutoCreated | |
LifecycleStates | array | No | The lifecycle status of the ECS instances in the scaling group. You can specify only one of LifecycleStates and LifecycleState at a time. We recommend that you specify this parameter. | |
string | No | The lifecycle status of the ECS instance in the scaling group. Valid values:
| InService |
Response parameters
Examples
Sample success responses
JSON
format
{
"RequestId": "B13527BF-1FBD-4334-A512-20F5E9D3FB4D",
"PageSize": 10,
"PageNumber": 1,
"TotalSpotCount": 4,
"TotalCount": 1,
"ScalingInstances": [
{
"CreationTime": "2020-05-18T03:11Z",
"LoadBalancerWeight": 50,
"LaunchTemplateId": "lt-m5e3ofjr1zn1aw7****",
"InstanceId": "i-bp109k5j3dum1ce6****",
"SpotStrategy": "SpotWithPriceLimit",
"LaunchTemplateVersion": "1",
"HealthStatus": "Healthy",
"ScalingGroupId": "asg-bp1igpak5ft1flyp****",
"WarmupState": "NoNeedWarmup",
"LifecycleState": "InService",
"CreationType": "AutoCreated",
"ZoneId": "cn-hangzhou-g",
"ScalingConfigurationId": "asc-bp1i65jd06v04vdh****",
"Entrusted": true,
"WeightedCapacity": 4,
"CreatedTime": "2020-05-18T03:11:39Z",
"ScalingActivityId": "asa-bp1c9djwrgxjyk31****",
"ScalingInstanceId": "asi-j6cj1gcte640ekhb****",
"PrivateIpAddress": "1**.2*.1**.2**"
}
]
}
Error codes
For a list of error codes, visit the Service error codes.
Change history
Change time | Summary of changes | Operation |
---|---|---|
2023-11-14 | The request parameters of the API has changed. The response structure of the API has changed | View Change Details |
2023-11-03 | The response structure of the API has changed | View Change Details |
2023-07-19 | The request parameters of the API has changed | View Change Details |