# TriggerProps

Props for `Trigger`.

Extends: TriggerProps
Extends: TriggerOptions
Used as props by: Trigger

- Source: [`triggers/lib/trigger.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/triggers/lib/trigger.ts#L90)
- Type last changed: v2.73.0 · 6 Apr 2023

## 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

- `executeAfter`: [Construct](/cdk/api/v2/docs/constructs.Construct.html)[] = [] — Adds trigger dependencies. Execute this trigger only after these construct scopes have been provisioned.

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

- `executeBefore`: [Construct](/cdk/api/v2/docs/constructs.Construct.html)[] = [] — 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.

- `executeOnHandlerChange`: boolean = 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.

- `handler`: [Function](/cdk/api/v2/docs/aws-cdk-lib.aws_lambda.Function.html) (required) — The AWS Lambda function of the handler to execute.

- `invocationType`: [InvocationType](/cdk/api/v2/docs/aws-cdk-lib.triggers.InvocationType.html) = RequestResponse — The invocation type to invoke the Lambda function with.

- `timeout`: [Duration](/cdk/api/v2/docs/aws-cdk-lib.Duration.html) = Duration.minutes(2) — The timeout of the invocation call of the Lambda function to be triggered.
