Does AWS CloudWatch Events Rule supports any wildcards in S3 bucket/key names
The template code gave by Marto was not working for me, however the doc led to a solution:
{
"source": ["aws.s3"],
"account": ["1111111xxxxx"],
"detail": {
"eventSource": ["s3.amazonaws.com"],
"eventName": ["PutObject"],
"requestParameters": {
"bucketName": ["mybucket"],
"key": [{"prefix": "myfile-*"}]
}
}
}
Hope it helps.
I found a fancy solution for this using Content-based filtering (released in February 2020) like prefix for example.
So in your case, the solution should be:
{
"source": ["aws.s3"],
"account": ["1111111xxxxx"],
"detail": {
"eventSource": ["s3.amazonaws.com"],
"eventName": ["PutObject"],
"requestParameters": {
"bucketName": ["mybucket"],
"key": [{ "prefix": "myfile-" }]
}
}
}