You can call this operation to query lifecycle hooks.

Description

You can use one of the following methods to query lifecycle hooks:

  • Specify the LifecycleHookId.N parameter. In this case, you do not need to specify the ScalingGroupId and LifecycleHookName parameters.
  • Specify the ScalingGroupId parameter.
  • Specify both the ScalingGroupId and LifecycleHookName parameters.

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 No DescribeLifecycleHooks

The operation that you want to perform. Set the value to DescribeLifecycleHooks.

LifecycleHookId.N RepeatList No ash-****

The ID of the lifecycle hook.

LifecycleHookName String No Test

The name of the lifecycle hook.

PageNumber Integer No 1

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

Default value: 1

PageSize Integer No 50

The number of entries to return on each page. Maximum value: 50.

Default value: 50

ScalingGroupId String No asg-****

The ID of the scaling group.

Response parameters

Parameter Type Example Description
LifecycleHooks

The list of lifecycle hooks.

DefaultResult String CONTINUE

The action that the scaling group takes when the lifecycle hook times out.

HeartbeatTimeout Integer 60

The time that can elapse before the lifecycle hook times out. When the lifecycle hook times out, the scaling group performs the default action (DefaultResult).

LifecycleHookId String ash-****

The ID of the lifecycle hook.

LifecycleHookName String Test

The name of the lifecycle hook.

LifecycleTransition String SCALE_OUT

The type of the scaling activity to which the lifecycle hooks apply.

NotificationArn String acs:ess:cn-hangzhou:1111111111:queue/queue1

The Alibaba Cloud Resource Name (ARN) of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook.

NotificationMetadata String Test

The fixed string that you want to include when Auto Scaling sends a message about the wait state of the scaling activity to the notification target.

ScalingGroupId String asg-****

The ID of the scaling group.

PageNumber Integer 1

The initial page number.

PageSize Integer 50

The number of entries on each page.

RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

TotalCount Integer 1

The total number of lifecycle hooks.

Examples

Sample requests


http://ess.aliyuncs.com/?Action=DescribeLifecycleHooks
&ScalingGroupId=asg-****
&<Common request parameters>

Sample success responses

XML format

<DescribeLifecycleHooksResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <PageNumber>1</PageNumber>
    <PageSize>50</PageSize>
    <TotalCount>1</TotalCount>
    <LifecycleHooks>
        <LifecycleHook>
            <ScalingGroupId>asg-****</ScalingGroupId>
            <LifecycleHookId>ash-****</LifecycleHookId>
            <LifecycleHookName>Test</LifecycleHookName>
            <DefaultResult>CONTINUE</DefaultResult>
            <HeartbeatTimeout>60</HeartbeatTimeout>
            <LifecycleTransition>SCALE_OUT</LifecycleTransition>
            <NotificationMetadata>Test</NotificationMetadata>
            <NotificationArn>acs:ess:cn-hangzhou:1111111111:queue/queue1</NotificationArn>
        </LifecycleHook>
    </LifecycleHooks>
</DescribeLifecycleHooksResponse>

JSON format

{
	"PageNumber":"1",
	"TotalCount":"1",
	"PageSize":"50",
	"RequestId":"473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
	"LifecycleHooks":{
		"LifecycleHook":{
			"NotificationArn":"acs:ess:cn-hangzhou:1111111111:queue/queue1",
			"LifecycleTransition":"SCALE_OUT",
			"LifecycleHookId":"ash-****",
			"ScalingGroupId":"asg-****",
			"DefaultResult":"CONTINUE",
			"HeartbeatTimeout":"60",
			"NotificationMetadata":"Test",
			"LifecycleHookName":"Test"
		}
	}
}

Error codes

For more information about error codes, visit API Error Center.

HTTP status code

Error code

Error message

Description

400

InvalidParamter

The specified value of parameter is not valid.

The error message returned because the specified value of the parameter is invalid.