S3EventSourceV2
- class aws_cdk.aws_lambda_event_sources.S3EventSourceV2(bucket, *, events, filters=None)
Bases:
object
S3EventSourceV2 Use S3 bucket notifications as an event source for AWS Lambda.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_s3 as s3 from aws_cdk.aws_lambda_event_sources import S3EventSourceV2 # fn: lambda.Function bucket = s3.Bucket.from_bucket_name(self, "Bucket", "amzn-s3-demo-bucket") fn.add_event_source(S3EventSourceV2(bucket, events=[s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED], filters=[s3.NotificationKeyFilter(prefix="subdir/")] ))
- Parameters:
bucket (
IBucket
) –events (
Sequence
[EventType
]) – The s3 event types that will trigger the notification.filters (
Optional
[Sequence
[Union
[NotificationKeyFilter
,Dict
[str
,Any
]]]]) – S3 object key filter rules to determine which objects trigger this event. Each filter must include aprefix
and/orsuffix
that will be matched against the s3 object key. Refer to the S3 Developer Guide for details about allowed filter rules.
Methods