Skip to content

Commit 131bf6a

Browse files
committed
Limit the s3 trigger to .csv files
1 parent a9d35ba commit 131bf6a

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

infrastructure/lambda_s3_trigger/lambda_s3_trigger_stack.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,11 @@ def __init__(self, scope: Construct, id: str, **kwargs) -> None:
2727
s3.grant_read(function)
2828

2929
# create s3 notification for lambda function
30-
notification = aws_s3_notifications.LambdaDestination(function)
31-
32-
3330
# assign notification for the s3 event type (ex: OBJECT_CREATED)
34-
s3.add_event_notification(_s3.EventType.OBJECT_CREATED, notification)
31+
s3.add_event_notification(
32+
_s3.EventType.OBJECT_CREATED,
33+
aws_s3_notifications.LambdaDestination(function),
34+
_s3.NotificationKeyFilter(suffix=".csv")
35+
)
36+
37+

0 commit comments

Comments
 (0)