Specify specific file name trigger function

aws

#1

Hello,
I have several files in my S3 bucket, how do I configure the lambda function to be executed on a specific file update?
For example:

s3-bucket-us-east-1
└── ab73e0f35e
    └── 2016-12-16T10:58:45.123Z_7WdHajGGRbGfX-S0QRUG0Q
        ├── metadata.json
        ├── original.json
        └── updated.json
    └── 2016-12-20T10:58:45.123Z_GPSISqj2ToC-4aGd5YzG5g
        ├── metadata.json
        ├── original.json
        └── updated.json

and my serverless.yaml so far is:

service: update

provider:
  name: aws
  runtime: nodejs4.3
  iamRoleStatements:
    - Effect: Allow
      Action:
        - "s3:*"
      Resource: "*"
  environment:
    S3_INGEST_BUCKET: ${file(./config.js):${self:provider.stage}.S3_TRINTS_BUCKET}
package:
  artifact: handler.zip

functions:
  update:
    handler: handler.update
    events:
      - s3:
          bucket: s3-bucket-${opt:stage, self:provider.stage}-${self:provider.region}
          event: s3:ObjectCreated:Put

I see there is a filter in http://docs.aws.amazon.com/AmazonS3/latest/dev/NotificationHowTo.html, but how do you specify this for example to trigger the function only when the updated.json file has either been added or updated?

Any advice is much appreciated


#2

Amazon only supports prefix/suffix matching with filters, not exact match. The S3 event docs for Serverless include an example of how to configure those.