Amazon EventBridge event enrichment with AWS Lambda

Amazon EventBridge → AWS Lambda → Amazon EventBridge

Enrich events with Lambda and put them back onto the event bus for downstream consumers

This pattern will produce events with enrichment flag. Enricher (Lambda function) picks up the event, enriches then puts the event back onto the bus. Downstream consumers get the enriched event
How the enrichment works
  • 1. Producer raise event and stores enrich:true into the metadata of the event.
  • 2. Event bus consumes event
  • 3. Rule is setup to listen to all events that need enriching (using the metadata field and EventBridge filters)
  • 4. Enricher takes event, strips of the enrichment flag, and continues to enrich event using the detailType as the key. The enricher is opinionated and knows how to enrich based on the event and schema of the event.
  • 5. Every downstream consumer acts as usual, but now they have to add a filter onto the rule that makes sure enrich:true is not set onto the event (downside of the pattern).

Things to know
This pattern is an opinionated way to enrich data. Using event metadata with enrichment flags allows the rules to filter and process the events. The producer will need to add enrich onto the event and consumers will need to create rules ignoring this field.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub


Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-enrichment-with-lambda

Deploy

cdk deploy


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: cdk delete.

Created by:

David Boyne

David Boyne

Helping people learn about event-driven architectures and serverless

Follow on LinkedIn