Interface BasicLifecycleHookProps

All Superinterfaces:
software.amazon.jsii.JsiiSerializable
All Known Subinterfaces:
LifecycleHookProps
All Known Implementing Classes:
BasicLifecycleHookProps.Jsii$Proxy, LifecycleHookProps.Jsii$Proxy

@Generated(value="jsii-pacmak/1.127.0 (build 2117ad5)", date="2026-04-02T21:55:05.032Z") @Stability(Stable) public interface BasicLifecycleHookProps extends software.amazon.jsii.JsiiSerializable
Basic properties for a lifecycle hook.

Example:

 Vpc vpc;
 InstanceType instanceType;
 IMachineImage machineImage;
 AutoScalingGroup asg = AutoScalingGroup.Builder.create(this, "ASG")
         .vpc(vpc)
         .instanceType(instanceType)
         .machineImage(machineImage)
         // Configure instance lifecycle policy
         .instanceLifecyclePolicy(InstanceLifecyclePolicy.builder()
                 .retentionTriggers(RetentionTriggers.builder()
                         .terminateHookAbandon(TerminateHookAbandonAction.RETAIN)
                         .build())
                 .build())
         .build();
 // Add termination lifecycle hook (required for the policy to take effect)
 asg.addLifecycleHook("TerminationHook", BasicLifecycleHookProps.builder()
         .lifecycleTransition(LifecycleTransition.INSTANCE_TERMINATING)
         .build());
 
  • Method Details

    • getLifecycleTransition

      @Stability(Stable) @NotNull LifecycleTransition getLifecycleTransition()
      The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.
    • getDefaultResult

      @Stability(Stable) @Nullable default DefaultResult getDefaultResult()
      The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

      Default: Continue

    • getHeartbeatTimeout

      @Stability(Stable) @Nullable default Duration getHeartbeatTimeout()
      Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.

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

      Default: - No heartbeat timeout.

    • getLifecycleHookName

      @Stability(Stable) @Nullable default String getLifecycleHookName()
      Name of the lifecycle hook.

      Default: - Automatically generated name.

    • getNotificationMetadata

      @Stability(Stable) @Nullable default String getNotificationMetadata()
      Additional data to pass to the lifecycle hook target.

      Default: - No metadata.

    • getNotificationTarget

      @Stability(Stable) @Nullable default ILifecycleHookTarget getNotificationTarget()
      The target of the lifecycle hook.

      Default: - No target.

    • getRole

      @Stability(Stable) @Nullable default IRole getRole()
      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.

    • builder

      @Stability(Stable) static BasicLifecycleHookProps.Builder builder()
      Returns:
      a BasicLifecycleHookProps.Builder of BasicLifecycleHookProps