All Products
Search
Document Center

Auto Scaling:DescribeLifecycleHooks

Last Updated:Nov 11, 2024

Queries lifecycle hooks. If you want to check whether the configurations of your lifecycle hooks are correct or you want to query the details of multiple lifecycle hooks at the same time, you can call the DescribeLifecycleHooks operation. You can specify lifecycle hook IDs or scaling group IDs when you call this operation. This operation returns details such as the default actions, scaling activities, Alibaba Cloud Resource Names (ARNs) of notification recipients, and timeout periods of lifecycle hooks.

Operation description

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

  • Specify a list of lifecycle hook IDs by using the LifecycleHookIds parameter. In this case, you do not need to specify the ScalingGroupId and LifecycleHookName parameters.
  • Specify the scaling group ID by using the ScalingGroupId parameter.
  • Specify the scaling group ID by using the ScalingGroupId parameter and the lifecycle hook name by using the LifecycleHookName parameter at the same time.

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:DescribeLifecycleHooksget
  • ScalingGroup
    acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}
    none
none

Request parameters

ParameterTypeRequiredDescriptionExample
ScalingGroupIdstringNo

The ID of the scaling group.

asg-bp1igpak5ft1flyp****
LifecycleHookNamestringNo

The name of the lifecycle hook.

lifecyclehook****
PageNumberintegerNo

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

Default value: 1.

1
PageSizeintegerNo

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

Default value: 50.

50
LifecycleHookIdsarrayNo

The IDs of the lifecycle hooks that you want to query.

stringNo

The ID of the lifecycle hook that you want to query.

ash-bp1at9ufhmcf9cmy****
RegionIdstringNo

The region ID of the scaling group.

cn-beijing

Response parameters

ParameterTypeDescriptionExample
object

The response information.

RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E
PageNumberinteger

The page number of the returned page.

1
PageSizeinteger

The number of entries returned per page.

50
TotalCountinteger

The total number of lifecycle hooks.

1
LifecycleHooksarray<object>

The details of the lifecycle hooks.

LifecycleHookobject

Details of the lifecycle hooks.

DefaultResultstring

The next action that is performed after the lifecycle hook times out.

CONTINUE
LifecycleHookIdstring

The ID of the lifecycle hook.

ash-bp19d1032y9kij96****
LifecycleHookNamestring

The name of the lifecycle hook.

lifecyclehook****
LifecycleTransitionstring

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

SCALE_OUT
NotificationMetadatastring

The fixed string that is included in a notification that Auto Scaling sends when the lifecycle hook takes effect.

Test Lifecycle Hook.
NotificationArnstring

The ARN of the notification recipient when the lifecycle hook takes effect. The value of this parameter 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 you specified a Message Service (MNS) queue as the notification recipient, the return value is in the acs:mns:{region-id}:{account-id}:queue/{queuename} format.
  • If you specified an MNS topic as the notification recipient, the return value is in the acs:mns:{region-id}:{account-id}:topic/{topicname} format.
  • If you specified a CloudOps Orchestration Service (OOS) template as the notification recipient, the return value is in the acs:oos:{region-id}:{account-id}:template/{templatename} format.
  • If you specified an event bus as the notification recipient, the return value is in the acs:eventbridge:{region-id}:{account-id}:eventbus/default format.

The variables in the preceding formats have the following meanings:

  • region-id: the region ID of your scaling group.
  • account-id: the ID of your Alibaba Cloud.
  • queuename: the name of the MNS queue.
  • topicname: the name of the MNS topic.
  • templatename: the name of the OOS template.
acs:ess:cn-beijing:161456884340****:null/null
HeartbeatTimeoutinteger

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

60
ScalingGroupIdstring

The ID of the scaling group.

asg-bp1igpak5ft1flyp****
LifecycleHookStatusstring

The status of the lifecycle hook. Valid values:

  • Active: The lifecycle hook is enabled.
  • InActive: The lifecycle hook is disabled.
Active

Examples

Sample success responses

JSONformat

{
  "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, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-10-13The response structure of the API has changedView Change Details