All Products
Search
Document Center

Auto Scaling:DescribeLifecycleActions

Last Updated:Dec 11, 2024

Queries the details of a lifecycle hook. If you want to query the details of a lifecycle hook, you can call the DescribeLifecycleActions operation. For example, you can query the execution status and ID of a lifecycle hook, along with the Elastic Compute Service (ECS) instances on which the lifecycle hook takes effect. When you call this operation, you can specify parameters such as ScalingActivityId, LifecycleActionToken, and MaxResults to query the details of a lifecycle hook.

Operation description

If a scaling activity is executed and a lifecycle hook is created for the scaling activity, the lifecycle hook triggers a lifecycle action. A lifecycle action can be in one of the following states:

  • If a lifecycle action is in the Pending state, Elastic Compute Service (ECS) instances are waiting to be added to a scaling group or waiting to be removed from a scaling group.
  • If a lifecycle action is in the Timeout state, the lifecycle hook that triggers the lifecycle action expires and ECS instances are added to or removed from a scaling group.
  • If a lifecycle action is in the Completed state, you manually end the lifecycle hook that triggers the lifecycle action ahead of schedule.

If you do not specify the action to perform, such as execute a specific OOS template, after a lifecycle hook ends, you can call this operation to obtain the token of the lifecycle action that corresponds to the lifecycle hook. Then, you can specify a custom action to perform after the lifecycle hook ends.

Debugging

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

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.
OperationAccess levelResource typeCondition keyAssociated operation
ess:DescribeLifecycleActionsget
*All Resources
*
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingActivityIdstringYes

The ID of the scaling activity.

asa-bp17mug9t0pegagw****
LifecycleActionStatusstringNo

The status of the lifecycle action. Valid values:

  • If a lifecycle action is in the Pending state, Elastic Compute Service (ECS) instances are waiting to be added to a scaling group or waiting to be removed from a scaling group.
  • If a lifecycle action is in the Timeout state, the lifecycle hook that triggers the lifecycle action ends, and ECS instances are added to or removed from the scaling group.
  • If a lifecycle action is in the Completed state, you manually end the lifecycle hook that triggers the lifecycle action ahead of schedule.
Pending
NextTokenstringNo

The token that is used to specify the lifecycle action from which the query starts.

For example, after the first 10 lifecycle actions are queried, the query starts from the 11th lifecycle action. Set this parameter to the NextToken value that is returned in the previous API call. If you do not specify this parameter, the query starts from the beginning.

AAAAAcSz4VTb1Nq****
MaxResultsintegerNo

The maximum number of entries to return on each page. Valid values: 1 to 50.

Default value: 10.

10
RegionIdstringNo

The region ID of the scaling group.

cn-qingdao

Response parameters

ParameterTypeDescriptionExample
object
NextTokenstring

The query token returned in this call.

AAAAAcSz4VTb1Nq****
RequestIdstring

The ID of the request.

42A742EB-FCF3-459E-9C62-E107048C17E3
TotalCountinteger

The total number of the queried lifecycle actions.

3
MaxResultsinteger

The maximum number of entries returned per page.

3
LifecycleActionsarray<object>

The actions of the lifecycle hook.

LifecycleActionobject

The lifecycle actions.

LifecycleHookIdstring

The ID of the lifecycle hook.

ash-bp18uoft0deax0f7****
LifecycleActionTokenstring

The token of the lifecycle hook action.

9C2E9DA7-F794-449A-ACF6-CEE24444F7BB
LifecycleActionStatusstring

The status of the lifecycle hook action.

Pending
LifecycleActionResultstring

The subsequent action that Auto Scaling performs after the lifecycle hook times out. Valid values:

  • CONTINUE: Auto Scaling continues to respond to a scale-in or scale-out request.
  • ABANDON: Auto Scaling releases ECS instances that are created during scale-out events, or removes ECS instances from the scaling group during scale-in events.
CONTINUE
InstanceIdsarray

The IDs of the ECS instances on which the lifecycle hook takes effect

InstanceIdstring

The ID of the ECS instance on which the lifecycle hook takes effect

["i-bp11m3fzlqrgk5vh****","i-bp11m3fzlqrgk5vh****"]

Examples

Sample success responses

JSONformat

{
  "NextToken": "AAAAAcSz4VTb1Nq****",
  "RequestId": "42A742EB-FCF3-459E-9C62-E107048C17E3",
  "TotalCount": 3,
  "MaxResults": 3,
  "LifecycleActions": [
    {
      "LifecycleHookId": "ash-bp18uoft0deax0f7****",
      "LifecycleActionToken": "9C2E9DA7-F794-449A-ACF6-CEE24444F7BB",
      "LifecycleActionStatus": "Pending",
      "LifecycleActionResult": "CONTINUE",
      "InstanceIds": [
        "[\"i-bp11m3fzlqrgk5vh****\",\"i-bp11m3fzlqrgk5vh****\"]"
      ]
    }
  ]
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
No change history