Modifies a lifecycle hook.

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 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. OpenAPI Explorer dynamically generates the sample code of the operation for different SDKs.

Request parameters

Parameter Type Required Example Description
Action String Yes ModifyLifecycleHook

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

LifecycleHookId String No ash-bp1fxuqyi98w0aib****

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

ScalingGroupId String No asg-bp18p2yfxow2dloq****

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

LifecycleHookName String No test_SCALE_IN

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

DefaultResult String No CONTINUE

The operation that is performed when 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.

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 starts to perform the action after the lifecycle hook that you want to modify times out. As a result, other lifecycle hooks time out ahead of schedule. In other cases, Auto Scaling performs the action only after all lifecycle hooks time out.

HeartbeatTimeout Integer No 600

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

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

LifecycleTransition String No SCALE_IN

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

  • SCALE_OUT
  • SCALE_IN
NotificationMetadata String No Test

The fixed string that is included in a notification when Auto Scaling sends the notification which indicates that the scaling activity is pending. The parameter value cannot exceed 4,096 characters in length.

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

NotificationArn String No acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****

The Alibaba Cloud Resource Name (ARN) of the notified party.

  • If the notified party is a Message Service (MNS) queue, the value format of this parameter is acs:mns:{region-id}:{account-id}:queue/{queuename}.
  • If the notified party is an MNS topic, the value format of this parameter is acs:mns:{region-id}:{account-id}:topic/{topicname}.
  • If the notified party is an Operation Orchestration Service (OOS) template, the value format of this parameter is acs:oos:{region-id}:{account-id}:template/{templatename}.

The variables in the preceding formats have the following meanings:

  • region-id: the ID of the region where the scaling group resides.
  • 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.
RegionId String No cn-beijing

The ID of the region where the scaling group resides.

Response parameters

Parameter Type Example Description
RequestId String 473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E

The ID of the request.

Examples

Sample requests

http(s)://ess.aliyuncs.com/?Action=ModifyLifecycleHook
&LifecycleHookId=ash-bp1fxuqyi98w0aib****
&ScalingGroupId=asg-bp18p2yfxow2dloq****
&LifecycleHookName=test_SCALE_IN
&DefaultResult=CONTINUE
&HeartbeatTimeout=600
&LifecycleTransition=SCALE_IN
&NotificationMetadata=Test
&NotificationArn=acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****
&RegionId=cn-beijing
&<Common request parameters>

Sample success responses

XML format

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

<ModifyLifecycleHookResponse>
    <RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3C83E</RequestId>
</ModifyLifecycleHookResponse>

JSON format

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

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

Error codes

For a list of error codes, visit the API Error Center.

HTTP status code

Error code

Error message

Description

400

InvalidParamter

The specified value of parameter is not valid.

The error message returned because the value that you specified for a parameter is invalid.

400

InvalidLifecycleHookId.NotExist

The specified lifecycleHookId not exist.

The error message returned because the lifecycle hook ID does not exist.

400

InvalidLifecycleHookName.NotExist

The specified lifecycleHookName you provided not exist.

The error message returned because the lifecycle hook name does not exist.

400

InvalidNotificationArn

The specified parameter NotificationArn is invalid.

The error message returned because the value that you specified for the NotificationArn parameter is invalid.

400

UnsupportedNotificationType.CurrentRegion

The NotificationType is not supported in the special region which scalingGroup belongs to.

The error message returned because the notification type is not supported in the region where the scaling group resides.

400

LifecycleHook

The specified queue does not exist.

The error message returned because the MNS queue does not exist.

400

TopicNotExist

The specified topic does not exist.

The error message returned because the MNS topic does not exist.