Modifies a lifecycle hook. If you want to modify a lifecycle hook to better align with your business requirements, you can call the ModifyLifecycleHook operation. This allows you to adjust attributes like the scaling activity type, timeout period, and default action of the lifecycle hook, without the need to delete and recreate it. You can specify the lifecycle hook ID, lifecycle hook name, and scaling group ID to locate the lifecycle hook that you want to modify.
Usage notes
You can use one of the following methods to locate the lifecycle hook that you want to modify:
Specify
LifecycleHookId
. In this case,ScalingGroupId
andLifecycleHookName
are ignored.Specify
ScalingGroupId
andLifecycleHookName
. The name of each lifecycle hook is unique in each scaling group.
Debugging
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_SCAL**** | The name of the lifecycle hook that you want to modify. |
DefaultResult | String | No | CONTINUE | The action that Auto Scaling performs after the lifecycle hook times out. Valid values:
When a scaling group has multiple lifecycle hooks in effect, and you set |
HeartbeatTimeout | Integer | No | 600 | 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. Valid values: 30 to 21600. Unit: seconds. You can call the RecordLifecycleActionHeartbeat operation to extend the timeout period of a lifecycle hook. You can also call the CompleteLifecycleAction operation to end the timeout period of a lifecycle hook ahead of schedule. |
LifecycleTransition | String | No | SCALE_IN | The type of the scaling activity to which you want to apply the lifecycle hook. Valid values:
|
NotificationMetadata | String | No | Test | The fixed string that you want to include in a notification. Each time the lifecycle hook takes effect, Auto Scaling sends a notification. The value of this parameter cannot exceed 4,096 characters in length. Auto Scaling sends the value of |
NotificationArn | String | No | acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo**** | The Alibaba Cloud Resource Name (ARN) of the notification recipient. The following list describes the value formats of this parameter:
The variables in the preceding value formats have the following meanings:
|
RegionId | String | No | cn-beijing | The region ID of the scaling group. |
LifecycleHookStatus | String | No | Active | The status that you want to specify for the lifecycle hook. Valid values: Valid values:
If you do not specify this parameter, the status of the lifecycle hook remains unchanged after you call this operation. Note By default, a new lifecycle hook automatically enters the Active state. |
Response parameters
Parameter | Type | Example | Description |
RequestId | String | 473469C7-AA6F-4DC5-B3DB-A3DC0DE3**** | The request ID. |
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
&LifecycleHookStatus=Active
&<Common request parameters>
Sample success responses
XML
format
HTTP/1.1 200 OK
Content-Type:application/xml
<ModifyLifecycleHookResponse>
<RequestId>473469C7-AA6F-4DC5-B3DB-A3DC0DE3****</RequestId>
</ModifyLifecycleHookResponse>
JSON
format
HTTP/1.1 200 OK
Content-Type:application/json
{
"RequestId" : "473469C7-AA6F-4DC5-B3DB-A3DC0DE3****"
}
Error codes
For a list of error codes, see Service error codes.
HTTP status code | Error code | Error message | Description |
400 | InvalidParamter | The specified value of parameter is not valid. | The value of a parameter is invalid. |
400 | InvalidLifecycleHookId.NotExist | The specified lifecycleHookId not exist. | The value of LifecycleHookId is invalid. |
400 | InvalidLifecycleHookName.NotExist | The specified lifecycleHookName you provided not exist. | The value of LifecycleHookName is invalid. |
400 | InvalidNotificationArn | The specified parameter NotificationArn is invalid. | The value of NotificationArn is invalid. |
400 | UnsupportedNotificationType.CurrentRegion | The NotificationType is not supported in the special region which scalingGroup belongs to. | The notification recipient is not supported in the region where the scaling group resides. |
400 | LifecycleHook | The specified queue does not exist. | The specified MNS queue does not exist. |
400 | TopicNotExist | The specified topic does not exist. | The specified MNS topic does not exist. |