interface BasicLifecycleHookProps
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AutoScaling.BasicLifecycleHookProps |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsautoscaling#BasicLifecycleHookProps |
Java | software.amazon.awscdk.services.autoscaling.BasicLifecycleHookProps |
Python | aws_cdk.aws_autoscaling.BasicLifecycleHookProps |
TypeScript (source) | aws-cdk-lib » aws_autoscaling » BasicLifecycleHookProps |
Basic properties for a lifecycle hook.
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,
});
Properties
| Name | Type | Description |
|---|---|---|
| lifecycle | Lifecycle | The state of the Amazon EC2 instance to which you want to attach the lifecycle hook. |
| default | Default | The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. |
| heartbeat | Duration | Maximum time between calls to RecordLifecycleActionHeartbeat for the hook. |
| lifecycle | string | Name of the lifecycle hook. |
| notification | string | Additional data to pass to the lifecycle hook target. |
| notification | ILifecycle | The target of the lifecycle hook. |
| role? | IRole | The role that allows publishing to the notification target. |
lifecycleTransition
Type:
Lifecycle
The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
defaultResult?
Type:
Default
(optional, default: Continue)
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
heartbeatTimeout?
Type:
Duration
(optional, default: No heartbeat timeout.)
Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.
If the lifecycle hook times out, perform the action in DefaultResult.
lifecycleHookName?
Type:
string
(optional, default: Automatically generated name.)
Name of the lifecycle hook.
notificationMetadata?
Type:
string
(optional, default: No metadata.)
Additional data to pass to the lifecycle hook target.
notificationTarget?
Type:
ILifecycle
(optional, default: No target.)
The target of the lifecycle hook.
role?
Type:
IRole
(optional, default: A role will be created if a target is provided. Otherwise, no role is created.)
The role that allows publishing to the notification target.

.NET
Go
Java
Python
TypeScript (