AWS::AutoScaling::LifecycleHookThe `AWS::AutoScaling::LifecycleHook` resource specifies lifecycle hooks for an Auto Scaling group. These hooks let you create solutions that are aware of events in the Auto Scaling instance lifecycle, and then perform a custom action on instances when the corresponding lifecycle event occurs. A lifecycle hook provides a specified amount of time (one hour by default) to wait for the action to complete before the instance transitions to the next state. Use lifecycle hooks to prepare new instances for use or to delay them from being registered behind a load balancer before their configuration has been applied completely. You can also use lifecycle hooks to prepare running instances to be terminated by, for example, downloading logs or other data. For more information, see [Amazon EC2 Auto Scaling lifecycle hooks](https://docs.aws.amazon.com/autoscaling/ec2/userguide/lifecycle-hooks.html) in the *Amazon EC2 Auto Scaling User Guide* .
import { CfnLifecycleHook } from 'aws-cdk-lib/aws-autoscaling';Or use the module namespace:
import * as autoscaling from 'aws-cdk-lib/aws-autoscaling';
// autoscaling.CfnLifecycleHookConfiguration passed to the constructor as CfnLifecycleHookProps.
autoScalingGroupNameRequiredstring | IAutoScalingGroupRefThe name of the Auto Scaling group.
lifecycleTransitionRequiredstringThe lifecycle transition. For Auto Scaling groups, there are two major lifecycle transitions. - To create a lifecycle hook for scale-out events, specify `autoscaling:EC2_INSTANCE_LAUNCHING` . - To create a lifecycle hook for scale-in events, specify `autoscaling:EC2_INSTANCE_TERMINATING` .
defaultResultOptionalstringThe action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs. The default value is `ABANDON` . Valid values: `CONTINUE` | `ABANDON`
heartbeatTimeoutOptionalnumberThe maximum time, in seconds, that can elapse before the lifecycle hook times out. The range is from `30` to `7200` seconds. The default value is `3600` seconds (1 hour).
lifecycleHookNameOptionalstringThe name of the lifecycle hook.
notificationMetadataOptionalstringAdditional information that you want to include any time Amazon EC2 Auto Scaling sends a message to the notification target.
notificationTargetArnOptionalstring | ITopicRef | IQueueRefThe Amazon Resource Name (ARN) of the notification target that Amazon EC2 Auto Scaling sends notifications to when an instance is in a wait state for the lifecycle hook. You can specify an Amazon SNS topic or an Amazon SQS queue.
roleArnOptionalstring | IRoleRefThe ARN of the IAM role that allows the Auto Scaling group to publish to the specified notification target. For information about creating this role, see [Prepare to add a lifecycle hook to your Auto Scaling group](https://docs.aws.amazon.com/autoscaling/ec2/userguide/prepare-for-lifecycle-notifications.html) in the *Amazon EC2 Auto Scaling User Guide* . Valid only if the notification target is an Amazon SNS topic or an Amazon SQS queue.
This L1 construct maps directly to the following CloudFormation resource type.
Our bi-weekly newsletter teaches hands-on AWS fundamentals. No certification fluff - just practical knowledge.
Subscribe to Newsletteraws-autoscalingAWS::AutoScaling::LifecycleHook