You can call this operation to modify the properties of a lifecycle hook.

Description

You can use either of the following methods to modify the properties of a lifecycle hook:

  • Specify the LifecycleHookId parameter. In this case, you do not need to specify the ScalingGroupId and LifecycleHookName parameters.
  • Specify both the ScalingGroupId and LifecycleHookName parameters.

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 No ModifyLifecycleHook

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

DefaultResult String No CONTINUE

The action that the scaling group takes when the lifecycle hook times out. Valid values:

  • CONTINUE: The scaling group continues to respond to a scale-in or scale-out event.
  • ABANDON: The scaling group releases the created ECS instances if the scaling activity type is scale-out or removes the ECS instances to be scaled-in if the scaling activity type is scale-in.

If a scaling group has multiple lifecycle hooks and one of them is terminated by the DefaultResult=ABANDON parameter during a scale-in event (SCALE_IN), the remaining lifecycle hooks for the same scaling group will also be terminated. Otherwise, the action following the wait state is the next action, as specified in the DefaultResult parameter, after the last lifecycle event under the same scaling group.

HeartbeatTimeout Integer No 600

The time that can elapse before the lifecycle hook times out. When the lifecycle hook times out, the scaling group performs the default action (DefaultResult). Valid values: 30 to 21600. Unit: seconds.

You can call the RecordLifecycleActionHeartbeat operation to extend the timeout period and keep the ECS instance in the wait state. You can also call the CompleteLifecycleAction operation to terminate the scaling activity.

LifecycleHookId String No ash-***

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

LifecycleHookName String No test_SCALE_IN

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

LifecycleTransition String No SCALE_IN

The type of the scaling activity to which the lifecycle hooks apply. Valid values:

  • SCALE_OUT: scale-out event
  • SCALE_IN: scale-in event
NotificationArn String No acs:ess:cn-hangzhou:1111111111:queue/queue2

The Alibaba Cloud Resource Name (ARN) of the notification target that Auto Scaling will use to notify you when an instance is in the transition state for the lifecycle hook. This target can be either an MNS queue or an MNS topic. The parameter value is in the acs:ess:{region}:{account-id}:{resource-relative-id} format.

  • region: the region to which the scaling group belongs
  • account-id: the ID of the Alibaba Cloud account

Example:

  • MNS queue: acs:ess:{region}:{account-id}:queue/{queuename}
  • MNS topic: acs:ess:{region}:{account-id}:topic/{topicname}
NotificationMetadata String No Test

The fixed string that you want to include when Auto Scaling sends a message about the wait state of the scaling activity to the notification target. The parameter value can be a maximum of 128 characters in length.

Auto Scaling will send the value of the NotificationMetadata parameter along with the notification message. This helps you categorize and manage your notifications. The NotificationMetadata parameter takes effect only after you specify the NotificationArn parameter.

ScalingGroupId String No AG6CQdPU8OKdwLjgZcJ2***

The ID of the scaling group.

Response parameters

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

The ID of the request.

Examples

Sample requests


http://ess.aliyuncs.com/?Action=ModifyLifecycleHook
&ScalingGroupId=AG6CQdPU8OKdwLjgZcJ****
&LifecycleHookName=test_SCALE_IN
&LifecycleTransition=SCALE_IN
&DefaultResult=ABANDON
&NotificationArn=acs:ess:cn-hangzhou:1111111111:queue/queue2
&NotificationMetadata=Test
&<Common request parameters>

Sample success responses

XML format

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

JSON format

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

Error codes

For more information about error codes, visit 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 specified value of the parameter is invalid.

400

InvalidLifecycleHookId.NotExist

The specified lifecycleHookId not exist.

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

400

InvalidLifecycleHookName.NotExist

The specified lifecycleHookName you provided not exist.

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

400

InvalidNotificationArn

The specified parameter **notificationArn** is invalid.

The error message returned because the specified Alibaba Cloud Resource Name (ARN) of the notification target does not exist.

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 to which the scaling group belongs.

400

LifecycleHook

The specified queue does not exist.

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

400

TopicNotExist

The specified topic does not exist.

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