Queries lifecycle hooks.

Usage notes

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

  • Specify a list of lifecycle hook IDs by using LifecycleHookId.N. In this case, you do not need to specify ScalingGroupId and LifecycleHookName.
  • Specify the scaling group ID by using ScalingGroupId.
  • Specify the scaling group ID by using ScalingGroupId and specify the lifecycle hook name by using LifecycleHookName.

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

ParameterTypeRequiredExampleDescription
ActionStringYesDescribeLifecycleHooks

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

ScalingGroupIdStringNoasg-bp1igpak5ft1flyp****

The ID of the scaling group.

LifecycleHookNameStringNolifecyclehook****

The name of the lifecycle hook.

PageNumberIntegerNo1

The page number. Pages start from page 1.

Default value: 1.

PageSizeIntegerNo50

The number of entries per page. Valid values: 1 to 50.

Default value: 50.

LifecycleHookId.NStringNoash-bp1at9ufhmcf9cmy****

The ID of the lifecycle hook.

RegionIdStringNocn-beijing

The region ID of the scaling group.

Response parameters

ParameterTypeExampleDescription
RequestIdString473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

PageNumberInteger1

The page number.

PageSizeInteger50

The number of entries per page.

TotalCountInteger1

The total number of lifecycle hooks.

LifecycleHooksArray of LifecycleHook

Details of the lifecycle hooks.

LifecycleHook
DefaultResultStringCONTINUE

The action that Auto Scaling performs when the lifecycle hook times out.

LifecycleHookIdStringash-bp19d1032y9kij96****

The ID of the lifecycle hook.

LifecycleHookNameStringlifecyclehook****

The name of the lifecycle hook.

LifecycleTransitionStringSCALE_OUT

The type of the scaling activity to which the lifecycle hook applies.

NotificationMetadataStringTest Lifecycle Hook.

The fixed string that is included in a notification which indicates that the lifecycle hook takes effect.

NotificationArnStringacs:ess:cn-beijing:161456884340****:null/null

The Alibaba Cloud Resource Name (ARN) of the notification method that is used by Auto Scaling to send notifications when the lifecycle hook takes effect. The value of this parameter is in one of the following formats:

  • If you do not create a notification rule, specify the value in the acs:ess:{region-id}:{account-id}:null/null format.
  • If you use a Message Service (MNS) queue as the notification method, specify the value in the acs:mns:{region-id}:{account-id}:queue/{queuename} format.
  • If you use an MNS topic as the notification method, specify the value in the acs:mns:{region-id}:{account-id}:topic/{topicname} format.
  • If you use an Operation Orchestration Service (OOS) template as the notification method, specify the value in the acs:oos:{region-id}:{account-id}:template/{templatename} format.
  • If you use an event bus provided by EventBridge as the notification method, specify the value in the acs:eventbridge:{region-id}:{account-id}:eventbus/default format.

The variables in the preceding value formats have the following meanings:

  • region-id: the region ID of the scaling group.
  • account-id: the ID of the Alibaba Cloud account.
  • queuename: the name of the MNS queue.
  • topicname: the name of the MNS topic.
  • templatename: the name of the OOS template.
HeartbeatTimeoutInteger60

The timeout period of the lifecycle hook. When the lifecycle hook times out, Auto Scaling performs the action that is specified by DefaultResult.

ScalingGroupIdStringasg-bp1igpak5ft1flyp****

The ID of the scaling group.

LifecycleHookStatusStringActive

The status of the lifecycle hook. Valid values:

  • Active
  • InActive

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=DescribeLifecycleHooks
&ScalingGroupId=asg-bp1igpak5ft1flyp****
&LifecycleHookName=lifecyclehook****
&PageNumber=1
&PageSize=50
&LifecycleHookId=["ash-bp1at9ufhmcf9cmy****"]
&RegionId=cn-beijing
&<Common request parameters>

Sample success responses

XML format

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

<DescribeLifecycleHooksResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
    <PageNumber>1</PageNumber>
    <PageSize>50</PageSize>
    <TotalCount>1</TotalCount>
    <LifecycleHooks>
        <DefaultResult>CONTINUE</DefaultResult>
        <LifecycleHookId>ash-bp19d1032y9kij96****</LifecycleHookId>
        <LifecycleHookName>lifecyclehook****</LifecycleHookName>
        <LifecycleTransition>SCALE_OUT</LifecycleTransition>
        <NotificationMetadata>Test Lifecycle Hook.</NotificationMetadata>
        <NotificationArn>acs:ess:cn-beijing:161456884340****:null/null</NotificationArn>
        <HeartbeatTimeout>60</HeartbeatTimeout>
        <ScalingGroupId>asg-bp1igpak5ft1flyp****</ScalingGroupId>
        <LifecycleHookStatus>Active</LifecycleHookStatus>
    </LifecycleHooks>
</DescribeLifecycleHooksResponse>

JSON format

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

{
  "RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E",
  "PageNumber" : 1,
  "PageSize" : 50,
  "TotalCount" : 1,
  "LifecycleHooks" : [ {
    "DefaultResult" : "CONTINUE",
    "LifecycleHookId" : "ash-bp19d1032y9kij96****",
    "LifecycleHookName" : "lifecyclehook****",
    "LifecycleTransition" : "SCALE_OUT",
    "NotificationMetadata" : "Test Lifecycle Hook.",
    "NotificationArn" : "acs:ess:cn-beijing:161456884340****:null/null",
    "HeartbeatTimeout" : 60,
    "ScalingGroupId" : "asg-bp1igpak5ft1flyp****",
    "LifecycleHookStatus" : "Active"
  } ]
}

HTTP status code

For a list of error codes, see Service error codes.

HTTP status code

Error code

Error message

Description

400

InvalidParamter

The specified value of parameter is not valid.

The value of a parameter is invalid.