All Products
Search
Document Center

Auto Scaling:ModifyLifecycleHook

Last Updated:Sep 10, 2026

Modifies the information of a lifecycle hook.

Operation description

Operation description

You can specify the lifecycle hook to modify in one of the following ways:

  • Specify only the lifecycle hook ID (LifecycleHookId). The scaling group ID (ScalingGroupId) and lifecycle hook name (LifecycleHookName) parameters are ignored.

  • Specify both the scaling group ID (ScalingGroupId) and lifecycle hook name (LifecycleHookName), because the lifecycle hook name is unique within a scaling group.

Try it now

Try this API in OpenAPI Explorer, no manual signing needed. Successful calls auto-generate SDK code matching your parameters. Download it with built-in credential security for local usage.

Test

RAM authorization

The table below describes the authorization required to call this API. You can define it in a Resource Access Management (RAM) policy. The table's columns are detailed below:

  • Action: The actions can be used in the Action element of RAM permission policy statements to grant permissions to perform the operation.

  • API: The API that you can call to perform the action.

  • Access level: The predefined level of access granted for each API. Valid values: create, list, get, update, and delete.

  • Resource type: The type of the resource that supports authorization to perform the action. It indicates if the action supports resource-level permission. The specified resource must be compatible with the action. Otherwise, the policy will be ineffective.

    • For APIs with resource-level permissions, required resource types are marked with an asterisk (*). Specify the corresponding Alibaba Cloud Resource Name (ARN) in the Resource element of the policy.

    • For APIs without resource-level permissions, it is shown as All Resources. Use an asterisk (*) in the Resource element of the policy.

  • Condition key: The condition keys defined by the service. The key allows for granular control, applying to either actions alone or actions associated with specific resources. In addition to service-specific condition keys, Alibaba Cloud provides a set of common condition keys applicable across all RAM-supported services.

  • Dependent action: The dependent actions required to run the action. To complete the action, the RAM user or the RAM role must have the permissions to perform all dependent actions.

Action

Access level

Resource type

Condition key

Dependent action

ess:ModifyLifecycleHook

update

*ScalingGroup

acs:ess:{#regionId}:{#accountId}:scalinggroup/{#ScalingGroupId}

None None

Request parameters

Parameter

Type

Required

Description

Example

LifecycleHookId

string

No

The ID of the lifecycle hook that you want to modify. This parameter is used to specify the lifecycle hook.

ash-bp1fxuqyi98w0aib****

ScalingGroupId

string

No

The ID of the scaling group. This parameter is used to specify the lifecycle hook.

asg-bp18p2yfxow2dloq****

LifecycleHookName

string

No

The name of the lifecycle hook that you want to modify. This parameter is used to specify the lifecycle hook.

test_SCAL****

DefaultResult

string

No

The action that Auto Scaling takes when the lifecycle hook times out. Valid values:

  • CONTINUE: Auto Scaling continues to response to scale-out or scale-down activities.

  • ABANDON: Auto Scaling releases the ECS instances that are created during scale-out activities or removes the ECS instances from the scaling group during scale-down activities.

  • ROLLBACK: For scale-down activities, Auto Scaling rejects the release of ECS instances and performs a rollback. For scale-out activities, Auto Scaling releases the created ECS instances, which has the same effect as ABANDON.

When a scale-down activity (SCALE_IN) occurs in a scaling group and triggers multiple lifecycle hooks, if the DefaultResult of a lifecycle hook is set to ABANDON or ROLLBACK and the wait state of the hook ends, the wait states of the other lifecycle hooks end early. In other cases, the action is determined by the last lifecycle hook whose wait state ends.

CONTINUE

HeartbeatTimeout

integer

No

The wait time that the lifecycle hook sets for the scaling activity. After the wait state times out, the default action is taken. Valid values: 30 to 21600. Unit: seconds.

You can call RecordLifecycleActionHeartbeat to extend the wait time for an ECS instance, or call CompleteLifecycleAction to end the wait state of a scaling activity early.

600

LifecycleTransition

string

No

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

  • SCALE_OUT: scale-out activities of the scaling group.

  • SCALE_IN: scale-down activities of the scaling group.

SCALE_IN

NotificationMetadata

string

No

The fixed string information that is associated with the wait state of a scaling activity. The parameter value cannot exceed 4,096 characters in length.

Each time Auto Scaling pushes a message to the Notification Recipient, it also sends the NotificationMetadata parameter value that you specify. This helps you manage and mark notifications of different categories. The NotificationMetadata parameter takes effect only when you also specify the NotificationArn parameter.

Test

NotificationArn

string

No

The identifier of the Notification Recipient for the lifecycle hook. This parameter supports the following notification methods:

  • Simple Message Queue (formerly MNS) queue: acs:mns:{region-id}:{account-id}:queue/{queuename}.

  • Simple Message Queue (formerly MNS) topic: acs:mns:{region-id}:{account-id}:topic/{topicname}.

  • OOS template: acs:oos:{region-id}:{account-id}:template/{templatename}.

  • EventBridge: acs:eventbridge:{region-id}:{account-id}:eventbus/default.

The variables in the parameter format are described as follows:

  • region-id: the region ID of the scaling group.

  • account-id: the Alibaba Cloud account ID.

  • queuename: the name of the Simple Message Queue (formerly MNS) queue.

  • topicname: the name of the Simple Message Queue (formerly MNS) topic.

  • templatename: the name of the OOS template.

acs:mns:cn-beijing:161456884340****:queue/modifyLifecycleHo****

RegionId

string

No

The region ID of the scaling group.

cn-beijing

LifecycleHookStatus

string

No

The status to which you want to change the lifecycle hook. Valid values:

  • Active: starts the lifecycle hook.

  • InActive: pauses the lifecycle hook.

If you do not specify this parameter, the lifecycle hook retains its current status.

Note

After a lifecycle hook is created, it is in the Active state by default.

Active

Response elements

Element

Type

Description

Example

object

RequestId

string

The request ID.

473469C7-AA6F-4DC5-B3DB-A3DC0DE3****

Examples

Success response

JSON format

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

Error codes

See Error Codes for a complete list.

Release notes

See Release Notes for a complete list.