# S3EventSourceProps

Extends: S3EventSourceProps
Used as props by: S3EventSource, S3EventSourceV2

- Source: [`aws-lambda-event-sources/lib/s3.ts`](https://github.com/aws/aws-cdk/blob/v2.275.0/packages/aws-cdk-lib/aws-lambda-event-sources/lib/s3.ts#L5)

## Example

```ts
import * as s3 from 'aws-cdk-lib/aws-s3';
import { S3EventSource } from 'aws-cdk-lib/aws-lambda-event-sources';

const bucket = new s3.Bucket(this, 'mybucket');
declare const fn: lambda.Function;

fn.addEventSource(new S3EventSource(bucket, {
  events: [ s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED ],
  filters: [ { prefix: 'subdir/' } ], // optional
}));
```

## Properties

- `events`: [EventType](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.EventType.html)[] (required) — The s3 event types that will trigger the notification.

- `filters`: [NotificationKeyFilter](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.NotificationKeyFilter.html)[] — S3 object key filter rules to determine which objects trigger this event.

  Each filter must include a `prefix` and/or `suffix` that will be matched
  against the s3 object key. Refer to the S3 Developer Guide for details
  about allowed filter rules.
