简体   繁体   中英

AWS EventBridge Rule Ignoring Key Prefix & Suffix Matching

I have an Event Bridge rule created where when I drop a file into an S3 bucket it will trigger a Step function.

I only want to trigger this rule when:

  • A file is in a folder called files/ ( prefix: "files/" )
  • The file is a CSV ( suffix: ".csv" )

However this rule is being triggered for any files regardless of their suffix and prefix. For instance I dropped a.pdf file in and it triggered the step function.

    {
      "detail-type": ["Object Created"],
      "source": ["aws.s3"],
      "detail": {
        "bucket": {
          "name": ["my-files-bucket"]
        },
        "object": {,
          "key": [{
            "prefix": "files/"
          }, {
            "suffix": ".csv"
          }]
        }
      }
    }

This is the expected behaviour. EventBridge treats multiple values in brackets as an OR condition . Events will match your pattern if the object key begins with files/ OR ends with .csv .

As far as I know, it's not possible to apply an AND condition to a single field.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM