Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Using event filtering on Lambda triggers

Using event filtering on Lambda triggers

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.

Jones Zachariah Noel N

June 24, 2023
Tweet

More Decks by Jones Zachariah Noel N

Other Decks in Technology

Transcript

  1. About me https://zachjonesnoel.com 👋 I’m Jones Zachariah Noel N (zachjonesnoel)

    🥑 Senior Developer Advocate @ Freshworks ☁ AWS Serverless Hero ⚡ Serverless architect 🚀 AWS UG Bengaluru co-organizer 󰞵 Runs newsletter / blog on The Serverless Terminal
  2. Event filtering supported services DynamoDB Streams Amazon SQS Kinesis Data

    Streams Amazon MQ Amazon MSK and self managed Apache Kafka
  3. Event filtering supported services DynamoDB Streams Amazon SQS Kinesis Data

    Streams Amazon MQ Amazon MSK and self managed Apache Kafka dynamodb body data data value
  4. Event filter expressions (SAM template) Events: DynamoDBTable: Type: DynamoDB Properties:

    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"]}'
  5. • Only the events which match the pattern invoke Lambda

    fn. • No additional cost, in-fact cost effective. • Manual comparison of events patterns. • Additional times of code. • Unnecessary invocation of Lambda fn.