LifecycleTransition Enum
What instance transition to attach the hook to.
Example
ts
declare const vpc: ec2.Vpc;
declare const instanceType: ec2.InstanceType;
declare const machineImage: ec2.IMachineImage;
const asg = new autoscaling.AutoScalingGroup(this, 'ASG', {
vpc,
instanceType,
machineImage,
// Configure instance lifecycle policy
instanceLifecyclePolicy: {
retentionTriggers: {
terminateHookAbandon: autoscaling.TerminateHookAbandonAction.RETAIN,
},
},
});
// Add termination lifecycle hook (required for the policy to take effect)
asg.addLifecycleHook('TerminationHook', {
lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_TERMINATING,
});
Members
| Member | Description |
|---|---|
INSTANCE_LAUNCHING | Execute the hook when an instance is about to be added. |
INSTANCE_TERMINATING | Execute the hook when an instance is about to be terminated. |
Referenced by
BasicLifecycleHookProps.lifecycleTransitionlifecycle_transitionlifecycleTransitionLifecycleTransitionLifecycleTransition