ModifyLifecycleHook

Updated at:

Modifies the information of a lifecycle hook.

Operation description

Operation description

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

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

  • Specify both the scaling group ID (ScalingGroupId) and the 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 to be modified. 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 to be modified. This parameter is used to specify the lifecycle hook.

test_SCAL****

DefaultResult

string

No

The action to be performed after the wait state ends. Valid values:

  • CONTINUE: continues the response to the scale-out or scale-in activity.

  • ABANDON: releases the ECS instances created during the scale-out activity or removes the ECS instances from the scaling group during the scale-in activity.

  • ROLLBACK: rejects the release of ECS instances and performs a rollback for a scale-in activity. For a scale-out activity, releases the created ECS instances, which has the same effect as ABANDON.

When a scale-in activity (SCALE_IN) occurs in a scaling group and triggers multiple lifecycle hooks, if the DefaultResult of one lifecycle hook is set to ABANDON or ROLLBACK, the wait states of other lifecycle hooks are ended in advance when the wait state of this hook ends. In other cases, the next action is subject to the next action of the last lifecycle hook that ends its wait state.

CONTINUE

HeartbeatTimeout

integer

No

The wait time set by the lifecycle hook for the scaling group activity. The next action is performed after the wait state times out. Valid values: 30 to 21600. Unit: seconds.

You can call the RecordLifecycleActionHeartbeat operation to extend the wait time of the ECS instance, or call the CompleteLifecycleAction operation to end the wait state of the scaling activity in advance.

600

LifecycleTransition

string

No

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

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

  • SCALE_IN: scale-in activity of the scaling group.

SCALE_IN

NotificationMetadata

string

No

The fixed string information for the wait state of the scaling activity. The value can be up to 4,096 characters in length.

Each time Auto Scaling pushes a message to the notification recipient, it also sends the predefined NotificationMetadata value to help you manage and tag different types of notification messages. 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. The following notification methods are supported when you set this parameter:

  • MNS queue. Format: acs:mns:{region-id}:{account-id}:queue/{queuename}.

  • MNS topic. Format: acs:mns:{region-id}:{account-id}:topic/{topicname}.

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

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

Variables in the formats have the following meanings:

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

  • account-id: the Alibaba Cloud account ID.

  • 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****

RegionId

string

No

The region ID of the scaling group.

cn-beijing

LifecycleHookStatus

string

No

Modifies the status of the current lifecycle hook. Valid values:

  • Active: starts the lifecycle hook.

  • InActive: pauses the lifecycle hook.

If you do not set this parameter, the status of the current lifecycle hook remains unchanged.

Note

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

Active

LifecycleActionSources

array

No

The specific scenarios triggered by the lifecycle hook.

string

No

The specific scenarios triggered by the lifecycle hook. Valid values when LifecycleTransition is set to SCALE_OUT:

  • DirectToScalingGroup: The instance is directly added to the scaling group during scale-out.

  • DirectToWarmPool: The instance is added to the warm pool during scale-out.

  • WarmPoolToScalingGroup: The instance is added to the scaling group from the warm pool during scale-out.

The default value in this case is DirectToScalingGroup.

Valid values when LifecycleTransition is set to SCALE_IN:

  • ScalingGroupToTerminate: The instance is directly removed from the scaling group during scale-in.

  • WarmPoolToTerminate: The instance is removed from the warm pool during scale-in.

  • ScalingGroupToWarmPool: The instance is reclaimed from the scaling group to the warm pool during scale-in.

The default value in this case is ScalingGroupToTerminate.

DirectToScalingGroup

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.