All Products
Search
Document Center

Auto Scaling:DescribeScalingInstances

Last Updated:Dec 28, 2023

Queries information about Elastic Compute Service (ECS) instances, elastic container instances, or managed non-Alibaba Cloud instances in a scaling group.

Usage notes

You can specify a scaling group ID to query the information about the ECS instances, elastic container instances, or managed non-Alibaba Cloud instances in the specified scaling group. You can also query instances by scaling configuration ID, instance health status, instance lifecycle status, and instance creation type.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer. OpenAPI Explorer dynamically generates the sample code for different SDKs.

Request parameters

Parameter

Type

Required

Example

Description

Action

String

Yes

DescribeScalingInstances

The operation that you want to perform. Set the value to DescribeScalingInstances.

RegionId

String

Yes

cn-hangzhou

The region ID of the scaling group.

ScalingGroupId

String

No

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

ScalingConfigurationId

String

No

asc-bp1i65jd06v04vdh****

The ID of the associated scaling configuration.

HealthStatus

String

No

Healthy

The health status of the ECS instance or elastic instance in the scaling group. An ECS instance or elastic container instance that is not in the Running state is considered unhealthy. Valid values:

  • Healthy

  • Unhealthy

Auto Scaling removes unhealthy ECS instances or elastic container instances from scaling groups. If the unhealthy ECS instances or elastic container instances are automatically created, Auto Scaling releases the instances after the removal.

Whether to release ECS instances or elastic container instances that are manually added to a scaling group is determined by the management status of the instances.

If the lifecycles of the 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 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 overdue payments, all pay-as-you-go and preemptible ECS instances or elastic container instances are stopped or even released. For information about status changes of ECS instances and elastic container instances in the event of overdue payments, see Overdue payments.

LifecycleState

String

No

InService

The lifecycle status of the ECS instance, elastic container instance, or managed non-Alibaba Cloud instance. Valid values:

  • InService: The instance is added to the scaling group and provides services as expected.

  • Pending: The instance is being added to the scaling group. When an ECS instance or elastic container instance is being added to the scaling group, the instance is also being attached to the associated Server Load Balancer (SLB) instance and its private IP address is being added to the IP address whitelist of the associated ApsaraDB RDS instance.

  • Pending:Wait: The instance is waiting to be added to the scaling group. If a scale-out lifecycle hook is created for the scaling group, the instance exits the Pending Wait state only after the scale-out lifecycle hook times out.

  • Protected: The instance is being protected. ECS instances or elastic container instances that are in the Protected state can provide services as expected. But you must manually manage the lifecycles of the instances.

  • Standby: The instance is on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their SLB weights are reset to zero. You must manually manage the lifecycles of the instances.

  • Stopped: The instance is stopped. ECS instances, elastic container instances, or managed non-Alibaba Cloud instances that are in the Stopped state cannot provide services as expected.

  • Removing: The instance is being removed from the scaling group. When an ECS instance or elastic container instance is being removed from the scaling group, the instance is also being detached from the associated SLB instance and its private IP address is being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

  • Removing:Wait: The instance is waiting to be removed from the scaling group. If a scale-in lifecycle hook is created for the scaling group, the instance exits the Removing Wait state only after the scale-in lifecycle hook times out.

    Note

    Managed non-Alibaba Cloud instances do not support the lifecycle hook, attachment to SLB, and health check features.

CreationType

String

No

AutoCreated

The instance creation type. Valid values:

  • AutoCreated: The ECS instance is automatically created by Auto Scaling based on the instance configuration source of the scaling group.

  • Attached: The ECS instance is manually added to the scaling group.

  • Managed: The ECS instance is a non-Alibaba Cloud instance that you manually added to the scaling group.

PageNumber

Integer

No

1

The page number. Pages start from page 1.

Default value: 1.

PageSize

Integer

No

10

The number of entries per page. Maximum value: 100.

Default value: 10.

ScalingActivityId

String

No

asa-bp1c9djwrgxjyk31****

The ID of the scaling activity.

InstanceId.N

String

No

i-bp109k5j3dum1ce6****

The ID of instance N in the scaling group. Valid values of N: 1 to 20.

Invalid instance IDs are not displayed in the query result, and no error is reported.

CreationTypes.N

String

No

AutoCreated

The instance creation type. If you specify this parameter, you cannot specify CreationType. Valid values:

  • AutoCreated: The ECS instance is automatically created by Auto Scaling based on the instance configuration source of the scaling group.

  • Attached: The ECS instance is manually added to the scaling group.

  • Managed: The ECS instance is a non-Alibaba Cloud instance that you manually added to the scaling group.

    Note

    You can specify one or more values for this parameter.

LifecycleStates.N

String

No

InService

The lifecycle status of the ECS instance, elastic container instance, or managed non-Alibaba Cloud instance. Valid values:

  • InService: The instance is added to the scaling group and provides services as expected.

  • Pending: The instance is being added to the scaling group. When an ECS instance or elastic container instance is being added to the scaling group, the instance is also being attached to the associated SLB instance and its private IP address is being added to the IP address whitelist of the associated ApsaraDB RDS instance.

  • Pending:Wait: The instance is waiting to be added to the scaling group. If a scale-out lifecycle hook is created for the scaling group, the instance exits the Pending Wait state only after the scale-out lifecycle hook times out.

  • Protected: The instance is being protected. ECS instances or elastic container instances that are in the Protected state can provide services as expected. But you must manually manage the lifecycles of the instances.

  • Standby: The instance is on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their SLB weights are reset to zero. You must manually manage the lifecycles of the instances.

  • Stopped: The instance is stopped. ECS instances, elastic container instances, or managed non-Alibaba Cloud instances that are in the Stopped state cannot provide services as expected.

  • Removing: The instance is being removed from the scaling group. When an ECS instance or elastic container instance is being removed from the scaling group, the instance is also being detached from the associated SLB instance and its private IP address is being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

  • Removing:Wait: The instance is waiting to be removed from the scaling group. If a scale-in lifecycle hook is created for the scaling group, the instance exits the Removing Wait state only after the scale-in lifecycle hook times out.

    Note

    Managed non-Alibaba Cloud instances do not support the lifecycle hook, attachment to SLB, and health check features.

Response parameters

Parameter

Type

Example

Description

RequestId

String

B13527BF-1FBD-4334-A512-20F5E9D3****

The request ID.

PageSize

Integer

10

The number of entries per page.

PageNumber

Integer

1

The page number.

TotalSpotCount

Integer

4

The total number of preemptible instances that run as expected in the scaling group.

TotalCount

Integer

1

The total number of instances.

ScalingInstances

Array of ScalingInstance

The information about the instances.

ScalingInstance

CreationTime

String

2020-05-18T03:11Z

The time when the instances were added to the scaling group. The value is accurate to minutes.

LoadBalancerWeight

Integer

50

The SLB weight of an instance as a backend server.

LaunchTemplateId

String

lt-m5e3ofjr1zn1aw7****

The ID of the launch template.

InstanceId

String

i-bp109k5j3dum1ce6****

The ID of the instance.

SpotStrategy

String

SpotWithPriceLimit

The bidding policy for the preemptible instance. Valid values:

  • SpotWithPriceLimit: The instance is a preemptible instance that has a user-defined maximum hourly price.

  • SpotAsPriceGo: The instance is created as a preemptible instance for which the market price at the time of purchase is automatically used as the bid price.

LaunchTemplateVersion

String

1

The version number of the launch template.

HealthStatus

String

Healthy

The health status of the ECS instance or elastic instance in the scaling group. An ECS instance or elastic container instance that is not in the Running state is considered unhealthy. Valid values:

  • Healthy

  • Unhealthy

Auto Scaling removes unhealthy ECS instances or elastic container instances from scaling groups. If the unhealthy ECS instances or elastic container instances are automatically created, Auto Scaling releases the instances after the removal.

Whether to release ECS instances or elastic container instances that are manually added to a scaling group is determined by the management status of the instances. If the lifecycles of the 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 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 overdue payments, all pay-as-you-go and preemptible ECS instances or elastic container instances are stopped or even released. For information about status changes of ECS instances and elastic container instances in the event of overdue payments, see Overdue payments.

ScalingGroupId

String

asg-bp1igpak5ft1flyp****

The ID of the scaling group to which the instances belong.

WarmupState

String

NoNeedWarmup

The warmup status of the instance. Valid values:

  • NoNeedWarmup: The instance does not need to be warmed up.

  • WaitingForInstanceWarmup: The instance is being warmed up.

  • InstanceWarmupFinish: The instance is warmed up.

LifecycleState

String

InService

The lifecycle status of the ECS instance, elastic container instance, or managed non-Alibaba Cloud instance in the scaling group. Valid values:

  • InService: The instance is added to the scaling group and provides services as expected.

  • Pending: The instance is being added to the scaling group. When an ECS instance or elastic container instance is being added to the scaling group, the instance is also being attached to the associated SLB instance and its private IP address is being added to the IP address whitelist of the associated ApsaraDB RDS instance.

  • Pending:Wait: The instance is waiting to be added to the scaling group. If a scale-out lifecycle hook is created for the scaling group, the instance exits the Pending Wait state only after the scale-out lifecycle hook times out.

  • Protected: The instance is being protected. ECS instances or elastic container instances that are in the Protected state can provide services as expected. But you must manually manage the lifecycles of the instances.

  • Standby: The instance is on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their SLB weights are reset to zero. You must manually manage the lifecycles of the instances.

  • Stopped: The instance is stopped. ECS instances, elastic container instances, or managed non-Alibaba Cloud instances that are in the Stopped state cannot provide services as expected.

  • Removing: The instance is being removed from the scaling group. When an ECS instance or elastic container instance is being removed from the scaling group, the instance is also being detached from the associated SLB instance and its private IP address is being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

  • Removing:Wait: The instance is waiting to be removed from the scaling group. If a scale-in lifecycle hook is created for the scaling group, the instance exits the Removing Wait state only after the scale-in lifecycle hook times out.

    Note

    Managed non-Alibaba Cloud instances do not support the lifecycle hook, attachment to SLB, and health check features.

CreationType

String

AutoCreated

The instance creation type. Valid values:

  • AutoCreated: The ECS instance is automatically created by Auto Scaling based on the instance configuration source of the scaling group.

  • Attached: The ECS instance is manually added to the scaling group.

  • Managed: The ECS instance is a non-Alibaba Cloud instance that you manually added to the scaling group.

ZoneId

String

cn-hangzhou-g

The zone ID of the instance.

ScalingConfigurationId

String

asc-bp1i65jd06v04vdh****

The ID of the associated scaling configuration.

Entrusted

Boolean

true

Indicates whether the lifecycles of the ECS instances that are manually added to the scaling group are managed by the scaling group. If the scaling group manages the lifecycles of the ECS instances that are manually added, Auto Scaling releases the ECS instances after Auto Scaling removes the ECS instances from the scaling group. The release rule does not apply to ECS instances that are manually removed from the scaling group. Valid values:

  • true

  • false

WeightedCapacity

Integer

4

The weight of the instance type, which indicates the capacity of a single instance of the specified instance type in the scaling group. A greater weight indicates that a smaller number of instances of the specified instance type are required to meet the expected capacity requirement.

CreatedTime

String

2020-05-18T03:11:39Z

The time when the instance was added to the scaling group. The value is accurate to seconds.

ScalingActivityId

String

asa-bp1c9djwrgxjyk31****

The ID of the scaling activity during which the instance was added to the scaling group.

InstanceType

String

ecs.n1.small

The instance type.

ScalingInstanceId

String

asi-j6cj1gcte640ekhb****

The identifier of the instance in the scaling group. The identifier of an ECS instance or elastic container instance matches the ID of the ECS instance or elastic container instance.

PrivateIpAddress

String

1**.2*.1**.2**

The private IP address of the instance in the scaling group.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DescribeScalingInstances
&RegionId=cn-hangzhou
&ScalingGroupId=asg-bp1igpak5ft1flyp****
&ScalingConfigurationId=asc-bp1i65jd06v04vdh****
&HealthStatus=Healthy
&LifecycleState=InService
&CreationType=AutoCreated
&PageNumber=1
&PageSize=10
&ScalingActivityId=asa-bp1c9djwrgxjyk31****
&InstanceId=["i-bp109k5j3dum1ce6****"]
&CreationTypes=["AutoCreated"]
&LifecycleStates=["InService"]
&<Common request parameters>

Sample success responses

XML format

HTTP/1.1 200 OK
Content-Type:application/xml

<DescribeScalingInstancesResponse>
    <RequestId>B13527BF-1FBD-4334-A512-20F5E9D3****</RequestId>
    <PageSize>10</PageSize>
    <PageNumber>1</PageNumber>
    <TotalSpotCount>4</TotalSpotCount>
    <TotalCount>1</TotalCount>
    <ScalingInstances>
        <CreationTime>2020-05-18T03:11Z</CreationTime>
        <LoadBalancerWeight>50</LoadBalancerWeight>
        <LaunchTemplateId>lt-m5e3ofjr1zn1aw7****</LaunchTemplateId>
        <InstanceId>i-bp109k5j3dum1ce6****</InstanceId>
        <SpotStrategy>SpotWithPriceLimit</SpotStrategy>
        <LaunchTemplateVersion>1</LaunchTemplateVersion>
        <HealthStatus>Healthy</HealthStatus>
        <ScalingGroupId>asg-bp1igpak5ft1flyp****</ScalingGroupId>
        <WarmupState>NoNeedWarmup</WarmupState>
        <LifecycleState>InService</LifecycleState>
        <CreationType>AutoCreated</CreationType>
        <ZoneId>cn-hangzhou-g</ZoneId>
        <ScalingConfigurationId>asc-bp1i65jd06v04vdh****</ScalingConfigurationId>
        <Entrusted>true</Entrusted>
        <WeightedCapacity>4</WeightedCapacity>
        <CreatedTime>2020-05-18T03:11:39Z</CreatedTime>
        <ScalingActivityId>asa-bp1c9djwrgxjyk31****</ScalingActivityId>
        <InstanceType>ecs.n1.small</InstanceType>
        <ScalingInstanceId>asi-j6cj1gcte640ekhb****</ScalingInstanceId>
        <PrivateIpAddress>1**.2*.1**.2**</PrivateIpAddress>
    </ScalingInstances>
</DescribeScalingInstancesResponse>

JSON format

HTTP/1.1 200 OK
Content-Type:application/json

{
  "RequestId" : "B13527BF-1FBD-4334-A512-20F5E9D3****",
  "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****",
    "InstanceType" : "ecs.n1.small",
    "ScalingInstanceId" : "asi-j6cj1gcte640ekhb****",
    "PrivateIpAddress" : "1**.2*.1**.2**"
  } ]
}

Error codes

For a list of error codes, see Service error codes.