# S3EventSource

Use S3 bucket notifications as an event source for AWS Lambda.

Extends: S3EventSource
Implements: IEventSource

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

## Example

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

declare const fn: lambda.Function;
const bucket = new s3.Bucket(this, 'Bucket');
fn.addEventSource(new eventsources.S3EventSource(bucket, {
  events: [ s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED ],
  filters: [ { prefix: 'subdir/' } ] // optional
}));
```

## Initializer

```ts
new S3EventSource(bucket: Bucket, props: S3EventSourceProps)
```

## Properties

- `bucket`: [Bucket](/cdk/api/v2/docs/aws-cdk-lib.aws_s3.Bucket.html) (required)

## Methods

- `bind(target: IFunction): void` — Called by `lambda.addEventSource` to allow the event source to bind to this function.
