When using triggers on Lambda functions, some of the AWS services support event filtering which can make your serverless architectures more performant and cost effective.
This was presented at AWS UG Madurai Serverless Day on June 24th, 2023.
Stream: !GetAtt DynamoDBTable.StreamArn StartingPosition: TRIM_HORIZON BatchSize: 100 FilterCriteria: Filters: # Filter pattern to check only inserted action on DynamoDB with the item_type being THREAT - Pattern: '{"eventName": ["INSERT"],"dynamodb":{"NewImage":{"item_type":{"S": [ "THREAT" ]}}}}' # Filter pattern to check only deleted action on DynamoDB - Pattern: '{"eventName": ["REMOVE"]}'
fn. • No additional cost, in-fact cost effective. • Manual comparison of events patterns. • Additional times of code. • Unnecessary invocation of Lambda fn.