amazon-web-servicesaws-lambdaserverless-frameworkserverlessserverless-architecture

How to add trigger for s3 event?


How to add a trigger for an s3 folder?

I can add triggers for a bucket from my serverless configuration.

But not sure how to add a trigger for a folder path?

    events:
      - s3:
          bucket: files          
          event: s3:ObjectCreated:*
          existing: true

Solution

  • You would have to setup a prefix as shown in the docs:

        events:
          - s3:
              bucket: files          
              event: s3:ObjectCreated:*
              existing: true
              rules:
                - prefix: your-folder/