2 Answers
- Newest
- Most votes
- Most comments
1
Hello.
I tested it with the same settings as below in my AWS account.
It was confirmed that when the file "CB-test.eml" is uploaded, the Lambda function "testfunc" runs, and when the file "CB-test.zip" is uploaded, the Lambda function "s3test" runs.
Therefore, I don't think there is any problem with multiple settings.
There may be a problem with the file name you are uploading.
{
"LambdaFunctionConfigurations": [
{
"Id": "test",
"LambdaFunctionArn": "arn:aws:lambda:ap-northeast-1:111111111111:function:s3test",
"Events": [
"s3:ObjectCreated:*",
"s3:ObjectRemoved:*"
],
"Filter": {
"Key": {
"FilterRules": [
{
"Name": "Prefix",
"Value": "CB"
},
{
"Name": "Suffix",
"Value": ".zip"
}
]
}
}
},
{
"Id": "test1",
"LambdaFunctionArn": "arn:aws:lambda:ap-northeast-1:111111111111:function:testfunc",
"Events": [
"s3:ObjectCreated:*"
],
"Filter": {
"Key": {
"FilterRules": [
{
"Name": "Prefix",
"Value": "CB"
},
{
"Name": "Suffix",
"Value": ".eml"
}
]
}
}
}
]
}
0
I found the (self-inflicted) answers to my problem so I thought I'd put it here in case it helps anyone.
- The Reporter lambda probably was being called, but it had a syntax error (a class I hadn't imported after the last change). I discovered this when I re-ran my test code from the lambda dashboard;
- Once the error was fixed, the lambda ran (it delivered the expected email) but produced no CloudWatch log streams. This was because the lambda's IAM role didn't include a policy that would give it permission to create or write to Cloud Watch. Once I added "CloudWatchFullAccessV2" everything worked as expected.
Pilot error again :)
David
answered 2 months ago
Relevant content
- Accepted Answerasked 5 years ago
- AWS OFFICIALUpdated a year ago
That's good news - at least it confirms that my understanding of how it should work is correct, and I'm not going crazy :)
I think you're right that the event filter isn't being matched and I'll re-check this again. It did occur to me earlier that the filename might have a hidden space or control character as the first character or something like that, but I haven't found a problem so far.
David