All Products
Search
Document Center

Auto Scaling:DescribeScalingInstances

Last Updated:Aug 07, 2024

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, number of Elastic Compute Service (ECS) instances, warm-up status of ECS instances, and lifecycle status of ECS instances in a scaling group. You can specify the scaling group ID when you call this operation. You can also call this operation to filter instances based on conditions, such as the instance health status, lifecycle status, and creation method.

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 of the operation 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 scaling configuration.

HealthStatus

String

No

Healthy

The health status of the instances. 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 instances are automatically created, Auto Scaling releases the instances after the removal.

The instance management status determines whether to release ECS instances or elastic container instances that are manually added to a scaling group. 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 your Alibaba Cloud account has sufficient balance. If your Alibaba Cloud account has overdue payments, all pay-as-you-go and preemptible ECS instances or elastic container instances are stopped or released in specific cases. For information about how the status of ECS instances and elastic container instances changes due to overdue payments, see Overdue payments.

LifecycleState

String

No

InService

The lifecycle status of the instances. Valid values:

  • InService: The instances are added to the scaling group and provide services as expected.

  • Pending: The instances are 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 load balancer and its private IP address is also being added to the IP address whitelist of the associated ApsaraDB RDS instance.

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

  • Protected: The instances are 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 instances are on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their load balancing weights are reset to zero. You must manually manage the lifecycles of the instances.

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

  • Removing: The instances are 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 load balancer and its private IP address is also being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

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

    Note

    Alibaba Cloud-managed third-party instances do not support the lifecycle hook, attachment to load balancers, and health check features.

CreationType

String

No

AutoCreated

The instance creation method. Valid values:

  • AutoCreated: Auto Scaling automatically creates ECS instances or elastic container instances based on the instance configuration source.

  • Attached: You manually add independent ECS instances or elastic container instances to the scaling group.

  • Managed: You manually add Alibaba Cloud-managed third-party instances 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 methods. If you specify this parameter, you cannot specify CreationType. Valid values:

  • AutoCreated: Auto Scaling automatically creates ECS instances based on the instance configuration source.

  • Attached: You manually add independent ECS instances to the scaling group.

  • Managed: You manually add Alibaba Cloud-managed third-party instances to the scaling group.

    Note

    You can specify one or more values for this parameter. For example, you can specify AutoCreated, Attached, and Managed as the values for this parameter at the same time.

LifecycleStates.N

String

No

InService

The lifecycle status of the instances. Valid values:

  • InService: The instances are added to the scaling group and provide services as expected.

  • Pending: The instances are 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 load balancer and its private IP address is also being added to the IP address whitelist of the associated ApsaraDB RDS instance.

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

  • Protected: The instances are 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 instances are on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their load balancing weights are reset to zero. You must manually manage the lifecycles of the instances.

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

  • Removing: The instances are 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 load balancer and its private IP address is also being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

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

    Note

    Alibaba Cloud-managed third-party instances do not support the lifecycle hook, attachment to load balancers, 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 the minute.

LoadBalancerWeight

Integer

50

The load balancing weight of each instance in the scaling group.

Note

The parameter is no longer available. We recommend that you do not specify this parameter.

LaunchTemplateId

String

lt-m5e3ofjr1zn1aw7****

The ID of the launch template.

InstanceId

String

i-bp109k5j3dum1ce6****

The ID of the instance.

SpotStrategy

String

SpotWithPriceLimit

The preemption policy of the preemptible instances. Valid values:

  • SpotWithPriceLimit: The instances were created as preemptible instances that have a user-defined maximum hourly price.

  • SpotAsPriceGo: The instances were created as preemptible instances for which the market price at the time of purchase was automatically used as the bid price.

LaunchTemplateVersion

String

1

The version number of the launch template.

HealthStatus

String

Healthy

The health status of the instance. 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 instances are automatically created, Auto Scaling releases the instances after the removal.

The instance management status determines whether to release ECS instances or elastic container instances that are manually added to a scaling group. 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 your Alibaba Cloud account has sufficient balance. If your Alibaba Cloud account has overdue payments, all pay-as-you-go and preemptible ECS instances or elastic container instances are stopped or released in specific cases. For information about how the status of ECS instances and elastic container instances changes due to overdue payments, see Overdue payments.

ScalingGroupId

String

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

WarmupState

String

NoNeedWarmup

The warm-up status of the instances. Valid values:

  • NoNeedWarmup: No warm-up is required.

  • WaitingForInstanceWarmup: The instances are being warmed up.

  • InstanceWarmupFinish: The instances are warmed up.

LifecycleState

String

InService

The lifecycle status of the instances. Valid values:

  • InService: The instances are added to the scaling group and provide services as expected.

  • Pending: The instances are 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 load balancer and its private IP address is also being added to the IP address whitelist of the associated ApsaraDB RDS instance.

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

  • Protected: The instances are 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 instances are on standby. ECS instances or elastic container instances that are in the Standby state cannot provide services as expected and their load balancing weights are reset to zero. You must manually manage the lifecycles of the instances.

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

  • Removing: The instances are 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 load balancer and its private IP address is also being removed from the IP address whitelist of the associated ApsaraDB RDS instance.

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

    Note

    Alibaba Cloud-managed third-party instances do not support the lifecycle hook, attachment to load balancers, and health check features.

CreationType

String

AutoCreated

The instance creation method. Valid values:

  • AutoCreated: Auto Scaling automatically creates ECS instances based on the instance configuration source.

  • Attached: You manually add independent ECS instances to the scaling group.

  • Managed: You manually add Alibaba Cloud-managed third-party instances to the scaling group.

ZoneId

String

cn-hangzhou-g

The zone ID.

ScalingConfigurationId

String

asc-bp1i65jd06v04vdh****

The ID of the scaling configuration.

Entrusted

Boolean

true

Indicates whether the lifecycles of the instances that are manually added to the scaling group are managed by the scaling group. If the scaling group manages the lifecycles of the instances that are manually added, Auto Scaling releases the instances after Auto Scaling removes the instances from the scaling group. The release rule does not apply to 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 higher weight indicates that a smaller number of instances of the instance type are required to meet the expected capacity requirement.

CreatedTime

String

2020-05-18T03:11:39Z

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

ScalingActivityId

String

asa-bp1c9djwrgxjyk31****

The ID of the scaling activity during which the instances were 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.