All Products
Search
Document Center

Auto Scaling:ModifyLifecycleHook

更新時間:Nov 11, 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

You can run this interface directly in OpenAPI Explorer, saving you the trouble of calculating signatures. After running successfully, OpenAPI Explorer can automatically generate SDK code samples.

Authorization information

The following table shows the authorization information corresponding to the API. The authorization information can be used in the Action policy element to grant a RAM user or RAM role the permissions to call this API operation. Description:

  • Operation: the value that you can use in the Action element to specify the operation on a resource.
  • Access level: the access level of each operation. The levels are read, write, and list.
  • Resource type: the type of the resource on which you can authorize the RAM user or the RAM role to perform the operation. Take note of the following items:
    • The required resource types are displayed in bold characters.
    • If the permissions cannot be granted at the resource level, All Resources is used in the Resource type column of the operation.
  • Condition Key: the condition key that is defined by the cloud service.
  • Associated operation: other operations that the RAM user or the RAM role must have permissions to perform to complete the operation. To complete the operation, the RAM user or the RAM role must have the permissions to perform the associated operations.
OperationAccess levelResource typeCondition keyAssociated operation
ess:ModifyLifecycleHookupdate
  • All Resources
    *
    none
none

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 changedView Change Details