AWS Fundamentals Logo
AWS Fundamentals
L2 Construct

LifecycleHook

Define a life cycle hook.

Import

import { LifecycleHook } from 'aws-cdk-lib/aws-autoscaling';

Or use the module namespace:

import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
// autoscaling.LifecycleHook

Properties

Configuration passed to the constructor as LifecycleHookProps.

autoScalingGroupRequired
IAutoScalingGroupRef

The AutoScalingGroup to add the lifecycle hook to.

7 properties inherited from BasicLifecycleHookProps
lifecycleTransitionRequiredinherited from BasicLifecycleHookProps
LifecycleTransition

The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.

defaultResultOptionalinherited from BasicLifecycleHookProps
DefaultResult

The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

Default: Continue

heartbeatTimeoutOptionalinherited from BasicLifecycleHookProps
Duration

Maximum time between calls to RecordLifecycleActionHeartbeat for the hook. If the lifecycle hook times out, perform the action in DefaultResult.

Default: - No heartbeat timeout.

lifecycleHookNameOptionalinherited from BasicLifecycleHookProps
string

Name of the lifecycle hook.

Default: - Automatically generated name.

notificationMetadataOptionalinherited from BasicLifecycleHookProps
string

Additional data to pass to the lifecycle hook target.

Default: - No metadata.

notificationTargetOptionalinherited from BasicLifecycleHookProps
ILifecycleHookTarget

The target of the lifecycle hook.

Default: - No target.

roleOptionalinherited from BasicLifecycleHookProps
IRole

The role that allows publishing to the notification target.

Default: - A role will be created if a target is provided. Otherwise, no role is created.

Learn AWS the Practical Way

Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.

Subscribe to Newsletter