Skip to content
v2.275.0

LifecycleHookProps Struct ​

Properties for a Lifecycle hook.

Example ​

ts
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import * as cdk from 'aws-cdk-lib';
import { aws_autoscaling as autoscaling } from 'aws-cdk-lib';
import { aws_iam as iam } from 'aws-cdk-lib';
import { aws_autoscaling as interfaces_autoscaling } from 'aws-cdk-lib/interfaces';

declare const autoScalingGroupRef: interfaces_autoscaling.IAutoScalingGroupRef;
declare const lifecycleHookTarget: autoscaling.ILifecycleHookTarget;
declare const role: iam.Role;
const lifecycleHookProps: autoscaling.LifecycleHookProps = {
  autoScalingGroup: autoScalingGroupRef,
  lifecycleTransition: autoscaling.LifecycleTransition.INSTANCE_LAUNCHING,

  // the properties below are optional
  defaultResult: autoscaling.DefaultResult.CONTINUE,
  heartbeatTimeout: cdk.Duration.minutes(30),
  lifecycleHookName: 'lifecycleHookName',
  notificationMetadata: 'notificationMetadata',
  notificationTarget: lifecycleHookTarget,
  role: role,
};

Properties ​

autoScalingGroupIAutoScalingGroupRefauto_scaling_groupIAutoScalingGroupRefautoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefAutoScalingGroupIAutoScalingGroupRefrequired#
The AutoScalingGroup to add the lifecycle hook to.
defaultResultoptionalDefaultResultdefault_resultoptionalDefaultResultdefaultResultoptionalDefaultResultDefaultResultoptionalDefaultResultDefaultResultoptionalDefaultResult= Continue#
The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.
heartbeatTimeoutoptionalDurationheartbeat_timeoutoptionalDurationheartbeatTimeoutoptionalDurationHeartbeatTimeoutoptionalDurationHeartbeatTimeoutoptionalDuration#
Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.

Default: No heartbeat timeout.

If the lifecycle hook times out, perform the action in DefaultResult.

lifecycleHookNameoptionalstringlifecycle_hook_nameoptionalstrlifecycleHookNameoptionalStringLifecycleHookNameoptionalstringLifecycleHookNameoptional*string#
Name of the lifecycle hook.

Default: Automatically generated name.

lifecycleTransitionLifecycleTransitionlifecycle_transitionLifecycleTransitionlifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransitionLifecycleTransitionrequired#
The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
notificationMetadataoptionalstringnotification_metadataoptionalstrnotificationMetadataoptionalStringNotificationMetadataoptionalstringNotificationMetadataoptional*string#
Additional data to pass to the lifecycle hook target.

Default: No metadata.

notificationTargetoptionalILifecycleHookTargetnotification_targetoptionalILifecycleHookTargetnotificationTargetoptionalILifecycleHookTargetNotificationTargetoptionalILifecycleHookTargetNotificationTargetoptionalILifecycleHookTarget#
The target of the lifecycle hook.

Default: No target.

roleoptionalIRoleroleoptionalIRoleroleoptionalIRoleRoleoptionalIRoleRoleoptionalIRole#
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.