How to setup trigger of function based on the S3 event

Hi guys,

How can I setup a event trigger for a function, based on a new object within my bucket.
I know that this works: s3:ObjectCreated:*
But this included the Post method, which I would like to exclude, Ideally this would work:
events:
- s3:
bucket: bucket
event:
- s3:ObjectCreated:Put
- s3:ObjectCreated:Copy
- s3:ObjectCreated:CompleteMultipartUpload

but it does not… any idea?

answering my own question, since found the way:

events:
      - s3:
          bucket: bucket_name
          event: s3:ObjectCreated:Put
          rules:
            - prefix: prefix
            - suffix: .zip
          existing: true
      - s3:
          bucket: bucket_name
          event: s3:ObjectCreated:CompleteMultipartUpload
          rules:
            - prefix: prefix
            - suffix: .zip
          existing: true
      - s3:
          bucket: bucket_name
          event: s3:ObjectCreated:Copy
          rules:
            - prefix: prefix
            - suffix: .zip
          existing: true

If i follow what you proposed, I receive this error :
Failed to create resource. Configurations overlap. Configurations on the same bucket cannot share a common event type.

I have the feeling we just can have 3 differents notifications on the s3 bucket.
However, if I check manually, I can have one single notifications for the three events.
Don’t understand.

Hi,

When I get the error of configurations overlapping is because the trigger was created manually, hence serverless deployment will not overwrite it. I’d manually go in the AWS console, delete whatever notification you have on that bucket/path and then re attempt to deploy.