Become a member
to unlock all features

    Create an S3 event notification to trigger a lambda function on file upload


    A huge part of building serverless applications with AWS is being able to connect certain cloud resources and have them react to certain events.

    Currently our HelloLambda function can be triggered by a GET request event sent to the API Gateway, but that's not the only use case when a lambda function can be triggered.

    Suppose we'd like to trigger the lambda function whenever a file is uploaded to an S3 bucket, for instance, to generate a thumbnail. Once a thumbnail is generated, lambda function can call another function etc., this behaviour is up to us to define.

    In order to call a lambda function when a file is uploaded to an S3 bucket, we need to use an s3Notifications construct - and that's exactly what we're going to do in this quick lesson.