Queries the Elastic Compute Service (ECS) instances in a scaling group and collects the details of the instances.

Description

You can query ECS instances in a scaling group by specifying the scaling group ID, scaling configuration ID, health status, lifecycle status, and how an ECS instance is created.

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 ID of the region to which the scaling group belongs.

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 in the scaling group. ECS instances that are not in the Running state are considered unhealthy. Valid values:

  • Healthy
  • Unhealthy

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 instance lifecycle. If the lifecycle of the ECS instances is not managed by the scaling group, Auto Scaling removes the instances from the scaling group but does not release them. If the lifecycle of the ECS instances is managed by the scaling group, Auto Scaling removes the instances from the scaling group and releases them.

Note Make sure that you have sufficient balance within your account. If you have overdue payments in your account, pay-as-you-go and preemptible instances are stopped or released. For information about how the status of ECS instances with overdue payments changes, see Overdue payments.
LifecycleState String No InService

The lifecycle status of the ECS instance in the scaling group. Valid values:

  • InService: The ECS instance is added to the scaling group and can provide services.
  • Pending: The ECS instance is being added to the scaling group. During this process, Auto Scaling adds the ECS instance to the backend server groups of the associated Server Load Balancer (SLB) instance and adds the IP address of the ECS instance to the whitelist that manages access to the associated ApsaraDB RDS instance.
  • Pending:Wait: The ECS instance is being added to the scaling group and enters the pending state. If a lifecycle hook that applies to scale-out activities is created for the scaling group, the ECS instance enters the pending state and waits for the lifecycle hook to time out before the instance is added to the scaling group.
  • Protected: The ECS instance is being protected. The ECS instance can provide services as expected. However, Auto Scaling does not manage the lifecycle of the instance. You must manually manage the lifecycle of the instance.
  • Standby: The ECS instance is on standby. The ECS instance is out of service and the weight of the ECS instance as an SLB backend server is set to zero. Auto Scaling does not manage the lifecycle of the instance. You must manually manage the lifecycle of the instance.
  • Stopped: The ECS instance is stopped. The ECS instance is stopped and cannot provide services.
  • Removing: The ECS instance is being removed from the scaling group. During this process, Auto Scaling removes the ECS instance from the backend server groups of the associated SLB instance and removes the IP address of the ECS instance from the whitelist that manages access to the associated ApsaraDB RDS instance.
  • Removing:Wait: The ECS instance is being removed from the scaling group and enters the pending state. If a lifecycle hook that applies to scale-in activities is created for the scaling group, the ECS instance enters the pending state and waits for the lifecycle hook to time out before the instance is removed from the scaling group.
CreationType String No AutoCreated

Specifies how the ECS instance is created. 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.
PageNumber Integer No 1

The number of the page to return. Pages start from page 1.

Default value: 1.

PageSize Integer No 10

The number of entries to return on each 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 ECS instance N. Valid values of N: 1 to 20.

The IDs of inactive instances are not displayed in the query result, and no errors are returned.

Response parameters

Parameter Type Example Description
RequestId String B13527BF-1FBD-4334-A512-20F5E9D3FB4D

The ID of the request.

PageSize Integer 10

The number of entries returned per page.

PageNumber Integer 1

The page number of the returned page.

TotalSpotCount Integer 4

The total number of running preemptible instances in the scaling group.

TotalCount Integer 1

The total number of ECS instances.

ScalingInstances Array of ScalingInstance

The collection of information about ECS instances.

ScalingInstance
CreationTime String 2020-05-18T03:11Z

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

LoadBalancerWeight Integer 50

The weight of the ECS instance as an SLB backend server.

LaunchTemplateId String lt-m5e3ofjr1zn1aw7****

The ID of the launch template.

InstanceId String i-bp109k5j3dum1ce6****

The ID of the ECS instance

SpotStrategy String SpotWithPriceLimit

The bidding policy for the preemptible instance. Valid values:

  • SpotWithPriceLimit: This policy applies to the preemptible instance with a user-defined maximum hourly price.
  • SpotAsPriceGo: This policy applies to the 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 in the scaling group. ECS instances that are not in the Running state are considered unhealthy. Valid values:

  • Healthy
  • Unhealthy

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 instance lifecycle. If the lifecycle of the ECS instances is not managed by the scaling group, Auto Scaling removes the instances from the scaling group but does not release them. If the lifecycle of the ECS instances is managed by the scaling group, Auto Scaling removes the instances from the scaling group and releases them.

Note Make sure that you have sufficient balance within your account. If you have overdue payments in your account, pay-as-you-go and preemptible instances are stopped or released. For information about how the status of ECS instances with overdue payments changes, see Overdue payments.
ScalingGroupId String asg-bp1igpak5ft1flyp****

The ID of the scaling group.

WarmupState String NoNeedWarmup

The warmup status of the ECS instance. Valid values:

  • NoNeedWarmup: No warmup is required.
  • WaitingForInstanceWarmup: You must wait for the instance to complete warmup.
  • InstanceWarmupFinish: The warmup is complete.
LifecycleState String InService

The lifecycle status of the ECS instance in the scaling group. Valid values:

  • InService: The ECS instance is added to the scaling group and can provide services.
  • Pending: The ECS instance is being added to the scaling group. During this process, Auto Scaling adds the ECS instance to the backend server groups of the associated SLB instance and adds the IP address of the ECS instance to the whitelist that manages access to the associated ApsaraDB RDS instance.
  • Pending:Wait: The ECS instance is being added to the scaling group and enters the pending state. If a lifecycle hook that applies to scale-out activities is created for the scaling group, the ECS instance enters the pending state and waits for the lifecycle hook to time out before the instance is added to the scaling group.
  • Protected: The ECS instance is being protected. The ECS instance can provide services as expected. However, Auto Scaling does not manage the lifecycle of the instance. You must manually manage the lifecycle of the instance.
  • Standby: The ECS instance is on standby. The ECS instance is out of service and the weight of the ECS instance as an SLB backend server is set to zero. Auto Scaling does not manage the lifecycle of the instance. You must manually manage the lifecycle of the instance.
  • Stopped: The ECS instance is stopped. The ECS instance is stopped and cannot provide services.
  • Removing: The ECS instance is being removed from the scaling group. During this process, Auto Scaling removes the ECS instance from the backend server groups of the associated SLB instance and removes the IP address of the ECS instance from the whitelist that manages access to the associated ApsaraDB RDS instance.
  • Removing:Wait: The ECS instance is being removed from the scaling group and enters the pending state. If a lifecycle hook that applies to scale-in activities is created for the scaling group, the ECS instance enters the pending state and waits for the lifecycle hook to time out before the instance is removed from the scaling group.
CreationType String AutoCreated

Indicates how the ECS instance is created. 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.
ZoneId String cn-hangzhou-g

The zone ID of the ECS instance.

ScalingConfigurationId String asc-bp1i65jd06v04vdh****

The ID of the associated scaling configuration.

Entrusted Boolean true

Indicates whether the scaling group is allowed to manage the instance lifecycle when you manually add the instance. If the scaling group is allowed to manage the instance lifecycle, Auto Scaling can release the instance when the instance is automatically removed from the scaling group. This rule does not apply to instances that are manually removed from the scaling group. Valid values:

  • true: The instance lifecycle is managed by the scaling group.
  • false: The instance lifecycle is not managed by the scaling group.
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.

CreatedTime String 2020-05-18T03:11:39Z

The time when the ECS instance was 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 ECS instance is added to the scaling group.

Examples

Sample requests

https://ess.aliyuncs.com/?Action=DescribeScalingInstances
&RegionId=cn-hangzhou
&<Common request parameters>

Sample success responses

XML format

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

<DescribeScalingInstancesResponse>
    <TotalCount>1</TotalCount>
    <PageSize>10</PageSize>
    <RequestId>D66AC79E-8299-4E0B-B681-3063C88E215B</RequestId>
    <PageNumber>1</PageNumber>
    <ScalingInstances>
        <ScalingInstance>
            <LoadBalancerWeight>50</LoadBalancerWeight>
            <CreatedTime>2020-12-21T03:11:00Z</CreatedTime>
            <WarmupState>NoNeedWarmup</WarmupState>
            <ZoneId>cn-hangzhou-g</ZoneId>
            <InstanceId>i-m5e3z5l951fibnd9****</InstanceId>
            <ScalingActivityId>asa-bp1c9djwrgxjyk31****</ScalingActivityId>
            <ScalingGroupId>asg-m5e8n5qw4atki7f6****</ScalingGroupId>
            <HealthStatus>Healthy</HealthStatus>
            <CreationTime>2020-12-21T03:11Z</CreationTime>
            <LifecycleState>InService</LifecycleState>
            <Entrusted>true</Entrusted>
            <ScalingConfigurationId>asc-m5e9vcoen45jspz7****</ScalingConfigurationId>
            <CreationType>AutoCreated</CreationType>
        </ScalingInstance>
    </ScalingInstances>
    <TotalSpotCount>0</TotalSpotCount>
</DescribeScalingInstancesResponse>

JSON format

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

{
  "TotalCount" : 1,
  "PageSize" : 10,
  "RequestId" : "D66AC79E-8299-4E0B-B681-3063C88E215B",
  "PageNumber" : 1,
  "ScalingInstances" : {
    "ScalingInstance" : [ {
      "LoadBalancerWeight" : 50,
      "CreatedTime" : "2020-12-21T03:11:00Z",
      "WarmupState" : "NoNeedWarmup",
      "ZoneId" : "cn-hangzhou-g",
      "InstanceId" : "i-m5e3z5l951fibnd9****",
      "ScalingActivityId" : "asa-bp1c9djwrgxjyk31****",
      "ScalingGroupId" : "asg-m5e8n5qw4atki7f6****",
      "HealthStatus" : "Healthy",
      "CreationTime" : "2020-12-21T03:11Z",
      "LifecycleState" : "InService",
      "Entrusted" : true,
      "ScalingConfigurationId" : "asc-m5e9vcoen45jspz7****",
      "CreationType" : "AutoCreated"
    } ]
  },
  "TotalSpotCount" : 0
}

Error codes

For a list of error codes, visit the API Error Center.