Skip to content
v2.274.0

TriggerProps Struct ​

Props for Trigger.

Example ​

ts
import * as triggers from 'aws-cdk-lib/triggers';

const func = new lambda.Function(this, 'MyFunction', {
  handler: 'index.handler',
  runtime: lambda.Runtime.NODEJS_LATEST,
  code: lambda.Code.fromInline('foo'),
});

new triggers.Trigger(this, 'MyTrigger', {
  handler: func,
  timeout: Duration.minutes(10),
  invocationType: triggers.InvocationType.EVENT,
});

Properties ​

executeAfterConstruct[]execute_aftertyping.List[Construct]executeAfterList<Construct>ExecuteAfterConstruct[]ExecuteAfter*[]Construct= []#
Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned.

You can also use trigger.executeAfter() to add additional dependencies.

executeBeforeConstruct[]execute_beforetyping.List[Construct]executeBeforeList<Construct>ExecuteBeforeConstruct[]ExecuteBefore*[]Construct= []#
Adds this trigger as a dependency on other constructs.

This means that this trigger will get executed before the given construct(s).

You can also use trigger.executeBefore() to add additional dependents.

executeOnHandlerChangebooleanexecute_on_handler_changeboolexecuteOnHandlerChangeBooleanExecuteOnHandlerChangeboolExecuteOnHandlerChange*bool= true#
Re-executes the trigger every time the handler changes.

This implies that the trigger is associated with the currentVersion of the handler, which gets recreated every time the handler or its configuration is updated.

handlerFunctionhandlerFunctionhandlerFunctionHandlerFunctionHandlerFunctionrequired#
The AWS Lambda function of the handler to execute.
invocationTypeInvocationTypeinvocation_typeInvocationTypeinvocationTypeInvocationTypeInvocationTypeInvocationTypeInvocationTypeInvocationType= RequestResponse#
The invocation type to invoke the Lambda function with.
timeoutDurationtimeoutDurationtimeoutDurationTimeoutDurationTimeoutDuration= Duration.minutes(2)#
The timeout of the invocation call of the Lambda function to be triggered.