enum LifecycleTransition
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AutoScaling.LifecycleTransition |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#LifecycleTransition |
Java | software.amazon.awscdk.services.autoscaling.LifecycleTransition |
Python | aws_cdk.aws_autoscaling.LifecycleTransition |
TypeScript (source) | aws-cdk-lib » aws_autoscaling » LifecycleTransition |
What instance transition to attach the hook to.
Example
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
| Name | 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. |
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.

.NET
Go
Java
Python
TypeScript (