Queries the lifecycle actions of a scaling activity.
Description
If a scaling activity whose type is the same as the type of a lifecycle hook occurs, the lifecycle hook triggers a lifecycle action. The status of a lifecycle action can be:
- Pending: Elastic Compute Service (ECS) instances in the scaling group enter the Pending state.
- Timeout: The lifecycle hook times out. ECS instances in the scaling group are automatically removed from the Pending state.
- Completed: ECS instances are manually removed from the Pending state.
If you do not specify the subsequent actions when you create a lifecycle hook, such as triggering the execution of a specific Operation Orchestration Service (OOS) template after the ECS instances are removed from the Pending state, you can call this operation to obtain the token of the lifecycle action that corresponds to the scaling activity. This helps you specify the subsequent actions.
Debugging
Request parameters
Parameter | Type | Required | Example | Description |
---|---|---|---|---|
Action | String | Yes | DescribeLifecycleActions |
The operation that you want to perform. Set the value to DescribeLifecycleActions. |
ScalingActivityId | String | Yes | asa-bp17mug9t0pegagw**** |
The ID of the scaling activity. |
LifecycleActionStatus | String | No | Pending |
The status of the lifecycle action. Valid values:
|
NextToken | String | No | AAAAAcSz4VTb1Nq**** |
The token that is used to specify the lifecycle action from which the query starts. For example, after the first 10 lifecycle actions were 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. |
MaxResults | Integer | No | 10 |
The maximum number of entries to return on each page. Valid values: 1 to 50. Default value: 10. |
RegionId | String | No | cn-qingdao |
The ID of the region where the scaling group resides. |
Response parameters
Parameter | Type | Example | Description |
---|---|---|---|
NextToken | String | AAAAAcSz4VTb1Nq**** |
The query token returned in this call. |
RequestId | String | 42A742EB-FCF3-459E-9C62-E107048C17E3 |
The ID of the request. |
TotalCount | Integer | 3 |
The total number of queried lifecycle actions. |
MaxResults | Integer | 3 |
The maximum number of entries returned per page. |
LifecycleActions | Array of LifecycleAction |
The lifecycle actions that correspond to each lifecycle hook. |
|
LifecycleAction | |||
LifecycleHookId | String | ash-bp18uoft0deax0f7**** |
The ID of the lifecycle hook. |
LifecycleActionToken | String | 9C2E9DA7-F794-449A-ACF6-CEE24444F7BB |
The token of the lifecycle action. |
LifecycleActionStatus | String | Pending |
The status of the lifecycle action. |
LifecycleActionResult | String | CONTINUE |
The action that is performed after the lifecycle action triggered by the lifecycle hook is complete. Valid values:
|
InstanceIds | Array of String | ["i-bp11m3fzlqrgk5vh****","i-bp11m3fzlqrgk5vh****"] |
The IDs of the ECS instances to which the lifecycle hook applies. |
Examples
Sample requests
http(s)://ess.aliyuncs.com/?Action=DescribeLifecycleActions
&ScalingActivityId=asa-bp17mug9t0pegagw****
&LifecycleActionStatus=Pending
&NextToken=AAAAAcSz4VTb1Nq****
&MaxResults=10
&RegionId=cn-qingdao
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<DescribeLifecycleActionsResponse>
<NextToken>AAAAAcSz4VTb1Nq****</NextToken>
<RequestId>42A742EB-FCF3-459E-9C62-E107048C17E3</RequestId>
<TotalCount>3</TotalCount>
<MaxResults>3</MaxResults>
<LifecycleActions>
<LifecycleHookId>ash-bp18uoft0deax0f7****</LifecycleHookId>
<LifecycleActionToken>9C2E9DA7-F794-449A-ACF6-CEE24444F7BB</LifecycleActionToken>
<LifecycleActionStatus>Pending</LifecycleActionStatus>
<LifecycleActionResult>CONTINUE</LifecycleActionResult>
<InstanceIds>["i-bp11m3fzlqrgk5vh****","i-bp11m3fzlqrgk5vh****"]</InstanceIds>
</LifecycleActions>
</DescribeLifecycleActionsResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"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 API Error Center.
HTTP status code |
Error code |
Error message |
Description |
---|---|---|---|
400 |
InvalidParameter |
The specified value of parameter "ScalingActivityId" is not valid. |
The error message returned because the value that you specified for the ScalingActivityId parameter is invalid. |
400 |
InvalidParameter |
The specified value of parameter "MaxResults" is not valid. |
The error message returned because the value that you specified for the MaxResults parameter is invalid. |
400 |
InvalidParameter |
The specified value of parameter "LifecycleActionStatus" is not valid. |
The error message returned because the value that you specified for the LifecycleActionStatus parameter is invalid. |