Skip to content
v2.274.0

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 ​

MemberDescription
INSTANCE_LAUNCHINGExecute the hook when an instance is about to be added.
INSTANCE_TERMINATINGExecute the hook when an instance is about to be terminated.

Referenced by ​

  • BasicLifecycleHookProps.lifecycleTransitionlifecycle_transitionlifecycleTransitionLifecycleTransitionLifecycleTransition