aws-cdk-lib.aws_autoscaling_hooktargets.FunctionHook

class FunctionHook

LanguageType name
.NETAmazon.CDK.AWS.AutoScaling.HookTargets.FunctionHook
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awsautoscalinghooktargets#FunctionHook
Javasoftware.amazon.awscdk.services.autoscaling.hooktargets.FunctionHook
Pythonaws_cdk.aws_autoscaling_hooktargets.FunctionHook
TypeScript (source)aws-cdk-lib » aws_autoscaling_hooktargets » FunctionHook

Implements ILifecycleHookTarget

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

NameDescription
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 BindHookTargetOptions

Returns

  • LifecycleHookTargetConfig

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.