All Products
Search
Document Center

Auto Scaling:ModifyLifecycleHook

Last Updated:Jun 24, 2024

Modifies a lifecycle hook. If an existing lifecycle hook does not meet your business requirements anymore, you can call the ModifyLifecycleHook operation to modify the information such as the scaling event, timeout period, and default action of the lifecycle hook. Before you modify a lifecycle hook, you can locate the lifecycle hook by its ID, name, or scaling group.

Operation description

You can use one of the following methods to locate the lifecycle hook that you want to modify:

  • Specify LifecycleHookId. In this case, ScalingGroupId and LifecycleHookName are ignored.
  • Specify ScalingGroupId and LifecycleHookName. Each lifecycle hook within a scaling group has a unique name.

Debugging

OpenAPI Explorer automatically calculates the signature value. For your convenience, we recommend that you call this operation in OpenAPI Explorer.

Authorization information

There is currently no authorization information disclosed in the API.

Request parameters

ParameterTypeRequiredDescriptionExample
LifecycleHookIdstringNo

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

ash-bp1fxuqyi98w0aib****
ScalingGroupIdstringNo

The ID of the scaling group to which the lifecycle hook belongs.

asg-bp18p2yfxow2dloq****
LifecycleHookNamestringNo

The name of the lifecycle hook that you want to modify.

test_SCALE_IN
DefaultResultstringNo

The action that you want Auto Scaling to perform after the lifecycle hook ends. Valid values:

  • CONTINUE: Auto Scaling continues to respond to scaling requests.
  • ABANDON: Auto Scaling releases Elastic Compute Service (ECS) instances that are created during scale-out activities, or removes ECS instances from the scaling group during scale-in activities.

If multiple lifecycle hooks in a scaling group are triggered during scale-in activities and you set the DefaultResult parameter to ABANDON for the lifecycle hook that you want to modify, Auto Scaling immediately performs the action after the lifecycle hook that you want to modify ends. As a result, other lifecycle hooks end ahead of schedule. In other cases, Auto Scaling performs the action only after all lifecycle hooks end.

CONTINUE
HeartbeatTimeoutintegerNo

The period of time before the lifecycle hook ends. Auto Scaling performs the specified action after the lifecycle hook ends. Valid values: 30 to 21600. Unit: seconds.

You can call the RecordLifecycleActionHeartbeat operation to prolong the length of a lifecycle hook. You can also call the CompleteLifecycleAction operation to end a lifecycle hook ahead of schedule.

600
LifecycleTransitionstringNo

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

  • SCALE_OUT
  • SCALE_IN
SCALE_IN
NotificationMetadatastringNo

The fixed string that is included in a notification. Auto Scaling sends the notification when the lifecycle hook takes effect. The value of this parameter cannot exceed 4,096 characters in length.

Auto Scaling sends the value specified for the NotificationMetadata parameter together with the notification. This helps you categorize your notifications. The NotificationMetadata parameter takes effect only after you specify the NotificationArn parameter.

Test
NotificationArnstringNo

The Alibaba Cloud Resource Name (ARN) of the notification method. Specify the value in one of the following formats:

  • If the notification method is a Message Service (MNS) queue, specify the value in the acs:mns:{region-id}:{account-id}:queue/{queuename} format.
  • If the notification method is an MNS topic, specify the value in the acs:mns:{region-id}:{account-id}:topic/{topicname} format.
  • If the notification method is an Operation Orchestration Service (OOS) template, specify the value in the acs:oos:{region-id}:{account-id}:template/{templatename} format.

The variables in the preceding parameter 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.
acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****
RegionIdstringNo

The region ID of the scaling group.

cn-beijing
LifecycleHookStatusstringNo

The status into which you want to put the lifecycle hook. Valid values:

  • Active
  • InActive

If you do not specify this parameter, the status of the lifecycle hook remains unchanged after you call this operation.

Note By default, a lifecycle hook is in the Active state after you create it.
Active

Response parameters

ParameterTypeDescriptionExample
object
RequestIdstring

The ID of the request.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Sample success responses

JSONformat

{
  "RequestId": "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}

Error codes

For a list of error codes, visit the Service error codes.

Change history

Change timeSummary of changesOperation
2022-10-13The request parameters of the API has changedsee changesets
Change itemChange content
Input ParametersThe request parameters of the API has changed.
    Added Input Parameters: LifecycleHookStatus