# BasicLifecycleHookProps

Basic properties for a lifecycle hook.

- Source: [`aws-autoscaling/lib/lifecycle-hook.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-autoscaling/lib/lifecycle-hook.ts#L15)
- Type last changed: v2.2.0 · 15 Dec 2021

## Example

```ts
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

- `defaultResult`: [DefaultResult](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.DefaultResult.html) = Continue — The action the Auto Scaling group takes when the lifecycle hook timeout elapses or if an unexpected failure occurs.

- `heartbeatTimeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) — Maximum time between calls to RecordLifecycleActionHeartbeat for the hook.

  **Default:** No heartbeat timeout.

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

- `lifecycleHookName`: string — Name of the lifecycle hook.

  **Default:** Automatically generated name.

- `lifecycleTransition`: [LifecycleTransition](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.LifecycleTransition.html) (required) — The state of the Amazon EC2 instance to which you want to attach the lifecycle hook.

- `notificationMetadata`: string — Additional data to pass to the lifecycle hook target.

  **Default:** No metadata.

- `notificationTarget`: [ILifecycleHookTarget](/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.ILifecycleHookTarget.html) — The target of the lifecycle hook.

  **Default:** No target.

- `role`: [IRole](/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — 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.
