From 7f41261efaca6c6ff69999d17e56cdad58c80778 Mon Sep 17 00:00:00 2001 From: Kashif Imran Date: Sat, 8 Aug 2020 22:33:26 -0700 Subject: [PATCH] Update textract-pipeline-stack.ts --- textract-pipeline/lib/textract-pipeline-stack.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/textract-pipeline/lib/textract-pipeline-stack.ts b/textract-pipeline/lib/textract-pipeline-stack.ts index 6a6fea90..b2939362 100644 --- a/textract-pipeline/lib/textract-pipeline-stack.ts +++ b/textract-pipeline/lib/textract-pipeline-stack.ts @@ -122,8 +122,20 @@ export class TextractPipelineStack extends cdk.Stack { s3Processor.addLayers(helperLayer) //Trigger s3Processor.addEventSource(new S3EventSource(contentBucket, { - - events: [ s3.EventType.OBJECT_CREATED ] + events: [ s3.EventType.OBJECT_CREATED ], + filters: [ { suffix: '.pdf' }] + })); + s3Processor.addEventSource(new S3EventSource(contentBucket, { + events: [ s3.EventType.OBJECT_CREATED ], + filters: [ { suffix: '.png' }] + })); + s3Processor.addEventSource(new S3EventSource(contentBucket, { + events: [ s3.EventType.OBJECT_CREATED ], + filters: [ { suffix: '.jpg' }] + })); + s3Processor.addEventSource(new S3EventSource(contentBucket, { + events: [ s3.EventType.OBJECT_CREATED ], + filters: [ { suffix: '.jpeg' }] })); //Permissions documentsTable.grantReadWriteData(s3Processor)