Avro on an Amazon EventBridge custom event bus

AWS Glue → Amazon EventBridge → 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 Python 3.14 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


Clone repo

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

Deploy

sam buildsam deploy --guided --capabilities CAPABILITY_NAMED_IAM


Testing

Install the publisher dependencies: python3 -m venv .venv && ./.venv/bin/pip install -r publisher/requirements.txt
Publish one Avro OrderPlaced event: scripts/run_publish.sh <stack-name> <region>
View the delivered event: aws logs tail /aws/lambda/avro-orders-consumer --since 5m --format short
See the GitHub repo for detailed testing instructions.

Cleanup

Delete the stack: sam delete.
Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Kurt Tometich

Kurt Tometich

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

Follow on LinkedIn