aws-cdk-lib.aws_lambda_event_sources.S3EventSourceProps

interface S3EventSourceProps

LanguageType name
.NETAmazon.CDK.AWS.Lambda.EventSources.S3EventSourceProps
Gogithub.com/aws/aws-cdk-go/awscdk/v2/awslambdaeventsources#S3EventSourceProps
Javasoftware.amazon.awscdk.services.lambda.eventsources.S3EventSourceProps
Pythonaws_cdk.aws_lambda_event_sources.S3EventSourceProps
TypeScript (source)aws-cdk-lib » aws_lambda_event_sources » S3EventSourceProps

Example

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
}));

Properties

NameTypeDescription
eventsEventType[]The s3 event types that will trigger the notification.
filters?NotificationKeyFilter[]S3 object key filter rules to determine which objects trigger this event.

events

Type: EventType[]

The s3 event types that will trigger the notification.


filters?

Type: NotificationKeyFilter[] (optional)

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.