All Products
Search
Document Center

Auto Scaling:DescribeLifecycleHooks

更新時間:Dec 24, 2024

Queries lifecycle hooks. When you call this operation, you can specify the lifecycle hook ID or scaling group ID to query the details of the desired lifecycle hook, such as the default action after the lifecycle hook times out, scaling event that corresponds to the lifecycle hook, Alibaba Cloud Resource Name (ARN) of the notification recipient, and effective period of the lifecycle hook.

Usage notes

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

  • Specify LifecycleHookId.N. In this case, ScalingGroupId and LifecycleHookName are ignored.

  • Specify ScalingGroupId.

  • Specify ScalingGroupId and LifecycleHookName at the same time.

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

Yes

DescribeLifecycleHooks

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

ScalingGroupId

String

No

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

LifecycleHookName

String

No

lifecyclehook****

The name of the lifecycle hook.

PageNumber

Integer

No

1

The page number. Pages start from page 1.

Default value: 1.

PageSize

Integer

No

50

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

Default value: 50.

LifecycleHookId.N

String

No

ash-bp1at9ufhmcf9cmy****

The ID of the lifecycle hook.

RegionId

String

No

cn-beijing

The region ID of the scaling group.

Response parameters

Parameter

Type

Example

Description

RequestId

String

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The request ID.

PageNumber

Integer

1

The page number.

PageSize

Integer

50

The number of entries per page.

TotalCount

Integer

1

The total number of lifecycle hooks.

LifecycleHooks

Array of LifecycleHook

The lifecycle hooks.

LifecycleHook

DefaultResult

String

CONTINUE

The next action after the lifecycle hook times out.

LifecycleHookId

String

ash-bp19d1032y9kij96****

The ID of the lifecycle hook.

LifecycleHookName

String

lifecyclehook****

The name of the lifecycle hook.

LifecycleTransition

String

SCALE_OUT

The type of the scaling event that corresponds to the lifecycle hook.

NotificationMetadata

String

Test Lifecycle Hook.

The fixed string that is included in notifications. When a lifecycle hook takes effect, Auto Scaling sends a notification.

NotificationArn

String

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

The ARN of the notification recipient. The value is in one of the following formats:

  • If you did not specify this parameter, the return value is in the acs:ess:{region-id}:{account-id}:null/null format.

  • If the notification recipient is a Simple Message Queue (SMQ, formerly MNS) queue, the return value is in the acs:mns:{region-id}:{account-id}:queue/{queuename} format.

  • If the notification recipient is an SMQ topic, the return value is in the acs:mns:{region-id}:{account-id}:topic/{topicname} format.

  • If the notification recipient is a CloudOps Orchestration Service (OOS) template, the return value is in the acs:oos:{region-id}:{account-id}:template/{templatename} format.

  • If the notification recipient is an event bus provided by EventBridge, the return value is 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 SMQ queue.

  • topicname: the name of the SMQ topic.

  • templatename: the name of the OOS template.

HeartbeatTimeout

Integer

60

The period of time during which the lifecycle hook takes effect. Auto Scaling performs the default action when the lifecycle hook times out.

ScalingGroupId

String

asg-bp1igpak5ft1flyp****

The ID of the scaling group.

LifecycleHookStatus

String

Active

The status of the lifecycle hook. Valid values:

  • Active: The lifecycle hook is enabled.

  • InActive: The lifecycle hook is disabled.

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"
  } ]
}

Error codes

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

HTTP status code

Error code

Description

Description

400

InvalidParamter

The specified value of parameter is not valid.

The value of a parameter is invalid.