aws-cdk-lib.aws_lambda_event_sources.S3EventSource

class S3EventSource

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

Implements IEventSource

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

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

Initializer

new S3EventSource(bucket: Bucket, props: S3EventSourceProps)

Parameters

  • bucket Bucket
  • props S3EventSourceProps

Properties

NameTypeDescription
bucketBucket

bucket

Type: Bucket

Methods

NameDescription
bind(target)Called by lambda.addEventSource to allow the event source to bind to this function.

bind(target)

public bind(target: IFunction): void

Parameters

  • target IFunction

Called by lambda.addEventSource to allow the event source to bind to this function.