I have an Event Bridge rule so that whenever an object is created in an S3 bucket, the rule is triggered. However, I would like to exclude a particular folder. To meet this condition I have tried using https://docs.aws.amazon.com/eventbridge/latest/userguide/eb-event-patterns-content-based-filtering.html#eb-filtering-suffix-matching Specifically, "Anything-but matching".
I am applying the following event pattern,
{
"detail": {
"bucket": {
"name": ["backend-data"]
},
"object": {
"key": [{
"anything-but": "folder/*"
}]
}
},
"detail-type": ["Object Created"],
"source": ["aws.s3"]
}
However it does not seem to have an effect, and does not exclude the folder. The problem is that it is not able to interpret "*".
I have tried to test it with an event similar to the following,
{
"version": "0",
"id": "123",
"detail-type": "Object Created",
"source": "aws.s3",
"account": "123",
"time": "2024-02-19T11:03:42Z",
"region": "us-east-1",
"resources": ["arn:aws:s3:::backend-data"],
"detail": {
"version": "0",
"bucket": {
"name": "backend-data"
},
"object": {
"key": "**folder/object.json.gz**",
"size": 123,
"etag": "asdf",
"version-id": "asdf",
"sequencer": "123"
},
"request-id": "ASDF",
"requester": "12312",
"source-ip-address": "123.0.0.0",
"reason": "PutObject"
}
}
And if I modify by the specific value, it works fine.
"key": [{
"anything-but": "folder/object.json.gz"
}]