All Products
Search
Document Center

Auto Scaling:ModifyLifecycleHook

Last Updated:Feb 28, 2024

Modifies a lifecycle hook.

Operation description

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

  • Specify the lifecycle hook ID by using the LifecycleHookId parameter. When you use this method, the ScalingGroupId and LifecycleHookName parameters are ignored.
  • Specify the scaling group ID by using the ScalingGroupId parameter and specify the lifecycle hook name by using the LifecycleHookName parameter.

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 times out. Valid values:

  • CONTINUE: Auto Scaling continues to respond to scale-in or scale-out 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.
  • ROLLBACK: For scale-in activities, Auto Scaling rejects the requests to release ECS instances but rolls back ECS instances. For scale-out activities, the ROLLBACK setting has the same effect as the ABANDON setting.

If a scaling group has multiple lifecycle hooks in effect and you set the DefaultResult parameter for one of the lifecycle hooks to ABANDON or ROLLBACK, the following rule applies to scale-in activities: When the lifecycle hook whose DefaultResult parameter is set to ABANDON or ROLLBACK times out, other lifecycle hooks time out ahead of schedule. In other cases, Auto Scaling performs the action only after all lifecycle hooks time out. The action that Auto Scaling performs is specified by the DefaultResult parameter of the last lifecycle hook that times out.

CONTINUE
HeartbeatTimeoutintegerNo

The period of time before the lifecycle hook times out. When the lifecycle hook times out, Auto Scaling performs the action specified by the DefaultResult parameter. Valid values: 30 to 21600. Unit: seconds.

You can call the RecordLifecycleActionHeartbeat operation to extend the period of time before a lifecycle hook times out. You can also call the CompleteLifecycleAction operation to end a lifecycle hook ahead of schedule.

600
LifecycleTransitionstringNo

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

  • SCALE_OUT: scale-out activity
  • SCALE_IN: scale-in activity
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 of the NotificationMetadata parameter together with the notification. This helps you categorize your notifications. If you specify the NotificationMetadata parameter, you must also specify the NotificationArn parameter.

Test
NotificationArnstringNo

The Alibaba Cloud Resource Name (ARN) of the notification method.

  • 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 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 that you want to specify for 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