class FunctionHook
| Language | Type name |
|---|---|
.NET | Amazon.CDK.AWS.AutoScaling.HookTargets.FunctionHook |
Go | github.com/aws/aws-cdk-go/awscdk/v2/awsautoscalinghooktargets#FunctionHook |
Java | software.amazon.awscdk.services.autoscaling.hooktargets.FunctionHook |
Python | aws_cdk.aws_autoscaling_hooktargets.FunctionHook |
TypeScript (source) | aws-cdk-lib » aws_autoscaling_hooktargets » FunctionHook |
Implements
ILifecycle
Use a Lambda Function as a hook target.
Internally creates a Topic to make the connection.
Example
// The code below shows an example of how to instantiate this type.
// The values are placeholders you should change.
import { aws_autoscaling_hooktargets as autoscaling_hooktargets } from 'aws-cdk-lib';
import { aws_kms as kms } from 'aws-cdk-lib';
import { aws_lambda as lambda } from 'aws-cdk-lib';
declare const function_: lambda.Function;
declare const key: kms.Key;
const functionHook = new autoscaling_hooktargets.FunctionHook(function_, /* all optional props */ key);
Initializer
new FunctionHook(fn: IFunction, encryptionKey?: IKey)
Parameters
- fn
IFunction— Function to invoke in response to a lifecycle event. - encryptionKey
IKey— If provided, this key is used to encrypt the contents of the SNS topic.
Methods
| Name | Description |
|---|---|
| bind(_scope, options) | If the IRole does not exist in options, will create an IRole and an SNS Topic and attach both to the lifecycle hook. |
bind(_scope, options)
public bind(_scope: Construct, options: BindHookTargetOptions): LifecycleHookTargetConfig
Parameters
- _scope
Construct - options
BindHook Target Options
Returns
If the IRole does not exist in options, will create an IRole and an SNS Topic and attach both to the lifecycle hook.
If the IRole does exist in options, will only create an SNS Topic and attach it to the lifecycle hook.

.NET
Go
Java
Python
TypeScript (