How to use the @aws-cdk/aws-lambda-event-sources.S3EventSource function in @aws-cdk/aws-lambda-event-sources

To help you get started, we’ve selected a few @aws-cdk/aws-lambda-event-sources examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws-samples / amazon-textract-serverless-large-scale-document-processing / textract-pipeline / lib / textract-pipeline-stack.ts View on Github external
// S3 Event processor
    const s3Processor = new lambda.Function(this, 'S3Processor', {
      runtime: lambda.Runtime.Python37,
      code: lambda.Code.asset('lambda/s3processor'),
      handler: 'lambda_function.lambda_handler',
      environment: {
        SYNC_QUEUE_URL: syncJobsQueue.queueUrl,
        ASYNC_QUEUE_URL: asyncJobsQueue.queueUrl,
        DOCUMENTS_TABLE: documentsTable.tableName,
        OUTPUT_TABLE: outputTable.tableName
      }
    });
    //Layer
    s3Processor.addLayer(helperLayer)
    //Trigger
    s3Processor.addEventSource(new S3EventSource(contentBucket, {
      events: [ s3.EventType.ObjectCreated ]
    }));
    //Permissions
    documentsTable.grantReadWriteData(s3Processor)
    syncJobsQueue.grantSendMessages(s3Processor)
    asyncJobsQueue.grantSendMessages(s3Processor)

    //------------------------------------------------------------

    // S3 Batch Operations Event processor 
    const s3BatchProcessor = new lambda.Function(this, 'S3BatchProcessor', {
      runtime: lambda.Runtime.Python37,
      code: lambda.Code.asset('lambda/s3batchprocessor'),
      handler: 'lambda_function.lambda_handler',
      environment: {
        DOCUMENTS_TABLE: documentsTable.tableName,
github PinkyJie / aws-transcribe-demo / aws-cdk / lib / lambda.ts View on Github external
SUPPORTED_AUDIO_SUFFIX.forEach(suffix => {
            this.addAudioFunc.addEventSource(
                new S3EventSource(props.audioFileBucket, {
                    events: [s3.EventType.OBJECT_CREATED],
                    filters: [{ suffix }],
                })
            );
        });

@aws-cdk/aws-lambda-event-sources

Event sources for AWS Lambda

Apache-2.0
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis