# BindHookTargetOptions

Options needed to bind a target to a lifecycle hook.

[disable-awslint:ref-via-interface] The lifecycle hook to attach to and an IRole to use

Used as argument in: [ILifecycleHookTarget.bind](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.ILifecycleHookTarget.html#bind)

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

## Example

TypeScript:

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

declare const lifecycleHook: autoscaling.LifecycleHook;
declare const role: iam.Role;
const bindHookTargetOptions: autoscaling.BindHookTargetOptions = {
  lifecycleHook: lifecycleHook,

  // the properties below are optional
  role: role,
};
```

Python:

```python
# The code below shows an example of how to instantiate this type.
# The values are placeholders you should change.
from aws_cdk import aws_autoscaling as autoscaling
from aws_cdk import aws_iam as iam

# lifecycle_hook: autoscaling.LifecycleHook
# role: iam.Role

bind_hook_target_options = autoscaling.BindHookTargetOptions(
    lifecycle_hook=lifecycle_hook,

    # the properties below are optional
    role=role
)
```

Java:

```java
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import software.amazon.awscdk.services.autoscaling.*;
import software.amazon.awscdk.services.iam.*;

LifecycleHook lifecycleHook;
Role role;

BindHookTargetOptions bindHookTargetOptions = BindHookTargetOptions.builder()
        .lifecycleHook(lifecycleHook)

        // the properties below are optional
        .role(role)
        .build();
```

C# / .NET:

```csharp
// Install: dotnet add package Amazon.CDK.Lib
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
using Amazon.CDK.AWS.AutoScaling;
using Amazon.CDK.AWS.IAM;

LifecycleHook lifecycleHook;
Role role;

var bindHookTargetOptions = new BindHookTargetOptions {
    LifecycleHook = lifecycleHook,

    // the properties below are optional
    Role = role
};
```

Golang:

```go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import "github.com/aws/aws-cdk-go/awscdk"
import "github.com/aws/aws-cdk-go/awscdk"

var lifecycleHook LifecycleHook
var role Role

bindHookTargetOptions := &BindHookTargetOptions{
	LifecycleHook: lifecycleHook,

	// the properties below are optional
	Role: role,
}
```

## Properties

- `lifecycleHook`: [LifecycleHook](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_autoscaling.LifecycleHook.html) (required) — The lifecycle hook to attach to.

  [disable-awslint:ref-via-interface]

- `role`: [IRole](https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.aws_iam.IRole.html) — The role to use when attaching to the lifecycle hook.

  **Default:** : a role is not created unless the target arn is specified

  [disable-awslint:ref-via-interface]
