Hi everyone,
I had problems with class S3BucketNotification, I’m using in two stack, but when I execute on second stack, overwrite the s3 event notification created on first stack.
stack1 -> bucketS3Notification1
stack2 -> bucketS3Notification2
Example
stack1.ts
// Bucket Notification Config
const s3BucketNotificationConfig: S3BucketNotificationConfig = {
bucket: bucketName,
lambdaFunction: [
{
lambdaFunctionArn: lambdaFunc.arn,
id: “lambda-event-processing-01”,
events: [“s3:ObjectCreated:*”],
filterPrefix: “dirname/process_control/”,
filterSuffix: “.csv”,
},
],
};// Create S3 Event Notification new S3BucketNotification( this, "s3-bucket-notification-01", s3BucketNotificationConfig );
stack2.ts
const s3BucketNotificationConfigCompat: S3BucketNotificationConfig = {
bucket: bucketName,
lambdaFunction: [
{
lambdaFunctionArn: lambdaFunc.arn,
id: “lambda-event-processing-02”,
events: [“s3:ObjectCreated:*”],
filterPrefix: “dirname/op_compat/”,
filterSuffix: “.txt”,
},
]
};// Create S3 Event Notification new S3BucketNotification( this, "s3-bucket-notification-02", s3BucketNotificationConfigCompat );