S3EventSourceProps
- class aws_cdk.aws_lambda_event_sources.S3EventSourceProps(*, events, filters=None)
Bases:
object
- Parameters:
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.
- ExampleMetadata:
infused
Example:
import aws_cdk.aws_s3 as s3 from aws_cdk.aws_lambda_event_sources import S3EventSource # fn: lambda.Function bucket = s3.Bucket(self, "mybucket") fn.add_event_source(S3EventSource(bucket, events=[s3.EventType.OBJECT_CREATED, s3.EventType.OBJECT_REMOVED], filters=[s3.NotificationKeyFilter(prefix="subdir/")] ))
Attributes
- events
The s3 event types that will trigger the notification.
- filters
S3 object key filter rules to determine which objects trigger this event.
Each filter must include a
prefix
and/orsuffix
that will be matched against the s3 object key. Refer to the S3 Developer Guide for details about allowed filter rules.