Avro on an Amazon EventBridge Custom Event Bus

AWS Glue → Amazon EventBridge Custom event bus → AWS Lambda → Amazon SQS DLQ → Amazon CloudWatch

Publish an Avro event to an Amazon EventBridge custom event bus, decoded against an AWS Glue Schema Registry, and deliver it as JSON to AWS Lambda.

This pattern shows how to publish a rich domain event, Avro-encoded, to an Amazon EventBridge custom event bus (the eventsv2 API) using PutRawEvents together with an AWS Glue Schema Registry, and then deliver that same event to an AWS Lambda subscriber.
The publisher encodes an OrderPlaced event against an Avro schema and wraps it in the AWS Glue wire format. Amazon EventBridge decodes the Avro against the AWS Glue registry server-side and delivers the payload as plain JSON, so the consumer AWS Lambda function needs no Avro library and simply logs the event to Amazon CloudWatch. A matching orderId, fields, and metadata prove the delivered event equals the one that was published.
This deploys one Amazon EventBridge custom event bus, one subscriber, an AWS Glue Schema Registry and Avro schema, one Node.js (TypeScript) AWS Lambda function, an Amazon SQS dead-letter queue, and the delivery role.

< Back to all patterns

GitHub icon Download this pattern (.zip)

GitHub icon View this pattern on GitHub

Variants

This pattern is available in the following frameworks/languages:

AWS SAM:JavaPythonTypeScript

Clone repo

git clone https://github.com/aws-samples/serverless-patterns/cd serverless-patterns/eventbridge-custom-avro/typescript/sam

Deploy

npm installsam buildsam deploy --guided --capabilities CAPABILITY_NAMED_IAM


Testing

See the GitHub repo for detailed testing instructions.

Cleanup

sam delete

Created by:

Kurt Tometich

Kurt Tometich

Kurt is a Sr. Solutions Architect based in Colorado who enjoys building lean, mean serverless solutions.