DescribeScalingInstances

Updated at:

Queries the list and details of ECS instances in a scaling group by scaling group ID. The details include the total number of running spot instances, the total number of ECS instances, and the warmup and lifecycle states of the ECS instances in the scaling group. This operation also allows you to filter ECS instances by health status, lifecycle state, and creation type.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ess:DescribeScalingInstances

get

*ScalingGroup

acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}

None None

Request parameters

Parameter

Type

Required

Description

Example

RegionId

string

Yes

The ID of the region to which the scaling group belongs.

cn-hangzhou

ScalingGroupId

string

No

The ID of the scaling group.

asg-bp1igpak5ft1flyp****

ScalingConfigurationId

string

No

The ID of the associated scaling configuration.

asc-bp1i65jd06v04vdh****

HealthStatus

string

No

The health status of the ECS instance or ECI instance in the scaling group. ECS instances or ECI instances that are not in the Running state are considered unhealthy. Valid values:

  • Healthy: The ECS instance or ECI instance is healthy.

  • Unhealthy: The ECS instance or ECI instance is unhealthy.

Auto Scaling automatically removes unhealthy ECS instances or ECI instances from the scaling group and releases the ECS instances or ECI instances that are automatically created.

Whether manually added ECS instances or ECI instances are released depends on their management status. If the instance lifecycle is not managed by the scaling group, the instance is only removed but not released. If the instance lifecycle is managed by the scaling group, the instance is removed and released.

Note

Make sure that your account is active and has sufficient balance. If your account has overdue payments, all pay-as-you-go ECS instances or ECI instances (including pay-as-you-go instances and spot instances) are stopped or even released. For more information about the status changes of ECS instances or ECI instances in a scaling group after overdue payments occur, see Overdue payments.

Healthy

LifecycleState

string

No

The lifecycle state of the ECS instance, ECI instance, or managed instances in the scaling group. Valid values:

  • InService: The ECS instance has been added to the scaling group and is providing services normally.

  • Pending: The ECS instance is being added. The procedure of adding an ECS instance or an ECI instance to a scaling group includes adding the ECS instance to the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Pending:Wait: The addition is suspended. If a lifecycle hook that applies to scale-out activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is added to the scaling group and waits for the hook timeout period to end.

  • Protected: The ECS instance is protected. The ECS instance or ECI instance is providing services normally, but Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Standby: The ECS instance is in the standby state. The ECS instance or ECI instance does not provide services, the weight of SLB backend server is set to zero, and Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Stopped: The ECS instance is stopped. The ECS instance, ECI instance, or managed instance is stopped and does not provide services.

  • Removing: The ECS instance is being removed. The procedure of removing an ECS instance or an ECI instance from a scaling group includes removing the ECS instance from the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Removing:Wait: The removal is suspended. If a lifecycle hook that applies to scale-down activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is removed from the scaling group and waits for the hook timeout period to end.

Note

Managed instances do not support configuring lifecycle hooks, associate with load balancing instances, or health check features.

InService

CreationType

string

No

The creation type of ECS instances in the scaling group. Valid values:

  • AutoCreated: The ECS instance or ECI instance is automatically created by Auto Scaling based on the instance configuration source.

  • Attached: The ECS instance or ECI instance is not created by Auto Scaling, but is manually added to the scaling group.

  • Managed: The managed instance is not created by Auto Scaling, but is manually added to the scaling group.

AutoCreated

PageNumber

integer

No

The page number of the instance list. Pages start from page 1.

Default value: 1.

1

PageSize

integer

No

The paging Settings for the number of entries per page in a paged query. Maximum value: 100.

Default value: 10.

10

ScalingActivityId

string

No

The ID of the scaling activity.

asa-bp1c9djwrgxjyk31****

InstanceId

array

No

The ID of the instance in the scaling group.

i-bp109k5j3dum1ce6****

string

No

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

Invalid InstanceIds are ignored in the returned query results, and no error is reported.

i-bp109k5j3dum1ce6****

CreationTypes

array

No

The creation types of the instances in the scaling group. You can specify only one of the CreationTypes and CreationType parameters.

string

No

The creation type of the instances in the scaling group. You cannot specify both the CreationTypes and CreationType parameters. Valid values:

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

  • Attached: The ECS instance is not created by Auto Scaling, but is manually added to the scaling group.

  • Managed: The managed instance is not created by Auto Scaling, but is manually added to the scaling group.

Note

Settings for this parameter: You can select multiple creation types (for example, AutoCreated, Attached, and Managed).

AutoCreated

LifecycleStates

array

No

The list of lifecycle states of the ECS instance, ECI instance, or managed instances in the scaling group. You can specify only one of the LifecycleStates and LifecycleState parameters. We recommend that you use this parameter.

string

No

The lifecycle state of the ECS instance, ECI instance, or managed instances in the scaling group. Valid values:

  • InService: The ECS instance has been added to the scaling group and is providing services normally.

  • Pending: The ECS instance is being added. The procedure of adding an ECS instance or an ECI instance to a scaling group includes adding the ECS instance to the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Pending:Wait: The addition is suspended. If a lifecycle hook that applies to scale-out activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is added to the scaling group and waits for the hook timeout period to end.

  • Protected: The ECS instance is protected. The ECS instance or ECI instance is providing services normally, but Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Standby: The ECS instance is in the standby state. The ECS instance or ECI instance does not provide services, the weight of SLB backend server is set to zero, and Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Stopped: The ECS instance is stopped. The ECS instance, ECI instance, or managed instance is stopped and does not provide services.

  • Removing: The ECS instance is being removed. The procedure of removing an ECS instance or an ECI instance from a scaling group includes removing the ECS instance from the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Removing:Wait: The removal is suspended. If a lifecycle hook that applies to scale-down activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is removed from the scaling group and waits for the hook timeout period to end.

Note

Managed instances do not support configuring lifecycle hooks, associate with load balancing instances, or health check features.

InService

Response elements

Element

Type

Description

Example

object

RequestId

string

The ID of the request.

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

PageSize

integer

The number of entries per page.

10

PageNumber

integer

The current page number.

1

TotalSpotCount

integer

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

4

TotalCount

integer

The total number of instances.

1

ScalingInstances

object

ScalingInstance

array<object>

The collection of instance information.

object

The collection of instance information.

CreationTime

string

The time when the instance was added to the scaling group. The time is displayed in UTC and follows the ISO 8601 standard. The time is accurate to minutes.

2020-05-18T03:11Z

LoadBalancerWeight

integer

The weight of the load balancing instance.

Note

[Deprecated] This parameter is deprecated and we recommend that you do not use it.

50

LaunchTemplateId

string

The ID of the launch template.

lt-m5e3ofjr1zn1aw7****

InstanceId

string

The ID of the instance.

i-bp109k5j3dum1ce6****

SpotStrategy

string

The preemption policy of the spot instance. Valid values:

  • SpotWithPriceLimit: The spot instance has a maximum hourly price.

  • SpotAsPriceGo: The system automatically places bids based on the current market price.

SpotWithPriceLimit

LaunchTemplateVersion

string

The version of the launch template.

1

HealthStatus

string

The health status of the ECS instance or ECI instance in the scaling group. ECS instances or ECI instances that are not in the Running state are considered unhealthy. Valid values:

  • Healthy: The ECS instance or ECI instance is healthy.

  • Unhealthy: The ECS instance or ECI instance is unhealthy.

Auto Scaling automatically removes unhealthy ECS instances or ECI instances from the scaling group and releases the ECS instances or ECI instances that are automatically created.

Whether manually added ECS instances or ECI instances are released depends on their management status. If the instance lifecycle is not managed by the scaling group, the instance is only removed but not released. If the instance lifecycle is managed by the scaling group, the instance is removed and released.

Note

Make sure that your account is active and has sufficient balance. If your account has overdue payments, all pay-as-you-go ECS instances or ECI instances (including pay-as-you-go instances and spot instances) are stopped or even released. For more information about the status changes of ECS instances or ECI instances in a scaling group after overdue payments occur, see Overdue payments.

Healthy

ScalingGroupId

string

The ID of the scaling group to which the instance belongs.

asg-bp1igpak5ft1flyp****

WarmupState

string

The warmup state of the instance. Valid values:

  • NoNeedWarmup: No warmup is required.

  • WaitingForInstanceWarmup: The instance is waiting for the warmup to complete.

  • InstanceWarmupFinish: The warmup is complete.

NoNeedWarmup

LifecycleState

string

The lifecycle state of the ECS instance, ECI instance, or managed instance in the scaling group. Valid values:

  • InService: The ECS instance has been added to the scaling group and is providing services normally.

  • Pending: The ECS instance is being added. The procedure of adding an ECS instance or an ECI instance to a scaling group includes adding the ECS instance to the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Pending:Wait: The addition is suspended. If a lifecycle hook that applies to scale-out activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is added to the scaling group and waits for the hook timeout period to end.

  • Protected: The ECS instance is protected. The ECS instance or ECI instance is providing services normally, but Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Standby: The ECS instance is in the standby state. The ECS instance or ECI instance does not provide services, the weight of SLB backend server is set to zero, and Auto Scaling does not manage the lifecycle of the ECS instance. You must manually manage the lifecycle.

  • Stopped: The ECS instance is stopped. The ECS instance, ECI instance, or managed instance is stopped and does not provide services.

  • Removing: The ECS instance is being removed. The procedure of removing an ECS instance or an ECI instance from a scaling group includes removing the ECS instance from the backend server group of a load balancing instance and the access whitelist of an ApsaraDB RDS instance.

  • Removing:Wait: The removal is suspended. If a lifecycle hook that applies to scale-down activities is created in the scaling group, the ECS instance or ECI instance is suspended when it is removed from the scaling group and waits for the hook timeout period to end.

Note

Managed instances do not support configuring lifecycle hooks, associate with load balancing instances, or health check features.

InService

CreationType

string

The creation type of the instance in the scaling group. Valid values:

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

  • Attached: The ECS instance is not created by Auto Scaling, but is manually added to the scaling group.

  • Managed: The managed instance is not created by Auto Scaling, but is manually added to the scaling group.

AutoCreated

ZoneId

string

The ID of the zone to which the instance belongs.

cn-hangzhou-g

ScalingConfigurationId

string

The ID of the associated scaling configuration.

asc-bp1i65jd06v04vdh****

Entrusted

boolean

Indicates whether the instance is managed by the scaling group when it is manually added to the scaling group. Manually added instances in the managed state are released when they are removed from the scaling group (excluding manual removal). Valid values:

  • true: The instance is managed by the scaling group.

  • false: The instance is not managed by the scaling group.

true

WeightedCapacity

integer

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

4

CreatedTime

string

The time when the instance was added to the scaling group. The time is displayed in UTC and follows the ISO 8601 standard. The time is accurate to seconds.

2020-05-18T03:11:39Z

ScalingActivityId

string

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

asa-bp1c9djwrgxjyk31****

InstanceType

string

The instance type.

ecs.n1.small

ScalingInstanceId

string

The instance identity in the scaling group, which corresponds one-to-one with the ID of the ECS instance or ECI instance.

asi-j6cj1gcte640ekhb****

PrivateIpAddress

string

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

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

ReplaceStatus

string

The instance replacement process that the instance is in. Valid values:

  • Normal: The instance is not in any replacement process.

  • ReBalance: The instance is in the rebalance replacement process of the scaling group.

  • SpotRemedy: The instance is in the spot remedy replacement process.

  • MaxInstanceLifetimeExpire: The instance is in the replacement process due to the expiration of the maximum instance lifetime.

  • InstanceRefresh: The instance is in the instance refresh replacement process.

  • SpotReplaceOnDemand: The instance is in the process of replacing a spot instance with a pay-as-you-go instance.

ReBalance

Examples

Success response

JSON format

{
  "RequestId": "B13527BF-1FBD-4334-A512-20F5E9D3****",
  "PageSize": 10,
  "PageNumber": 1,
  "TotalSpotCount": 4,
  "TotalCount": 1,
  "ScalingInstances": {
    "ScalingInstance": [
      {
        "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**",
        "ReplaceStatus": "ReBalance"
      }
    ]
  }
}

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.