user8128927
user8128927

Reputation:

Serverless Framework S3 Event Rule

I am creating a s3 listener using serverless framework. A user has requested a specific file format, for the s3 trigger for the event.

I currently have

functions:
    LambdaTrigger:
        name: ${self:service}-${self:custom.environment}
        description: lambda_trigger
        handler: handler.lambda_handler
        tags:
            project: ""
            owner: ""
            environment: ${self:custom.environment}
        events:
            - existingS3: 
                bucket: ${self:custom.listener_bucket_name}
                event: s3:ObjectCreated:*
                rules:
                    - prefix: ${self:custom.listener_prefix}
                    - suffix: ${self:custom.listener_suffix}

my user is requesting that lambda only be triggered when file is of

/ID1_ID2_ID3.tar

I have handled the prefix and the suffix condition in the above function, but I am wondering how or even if it is possible to construct a new rule to only be triggered when file has the format of ID1_ID2_ID3 where each id N integers.

Upvotes: 0

Views: 1155

Answers (1)

yorodm
yorodm

Reputation: 4461

According to the docs, an earlier question and my own experience in the matter, prefix and suffix parameters cannot be wildcard or regular expressions, so I'm affraid that unless you find some clever way to circunvent the restriction it's not possible to do what you want.

Upvotes: 1

Related Questions