Amazon EventBridge Custom Event Bus to Amazon SQS with observability

Publisher → Amazon EventBridge Custom Event Bus → Amazon SQS → Amazon SQS DLQ → Amazon CloudWatch

Deploy an Amazon EventBridge Custom Event Bus with a subscriber that delivers to Amazon SQS, with delivery logs and Amazon CloudWatch alarms to trace a missing event.

This pattern deploys an Amazon EventBridge Custom Event Bus with one subscriber. The subscriber filters events that have detail.orderId and delivers each match to an Amazon SQS queue. A second queue receives a failure record for any event that cannot be delivered after the first attempt and two retries.
The pattern also sets up what you need to follow one event from the publish call to the target. An Amazon CloudWatch Logs delivery sends the subscriber's delivery records to a log group, and five CloudWatch alarms cover publish failures, throttling, failed delivery attempts, events written to the dead-letter queue, and failed writes to it. A template parameter removes the delivery role's access to the target queue, so you can break delivery on purpose, see how the metrics, logs and alarms report it, and replay the failed events from the bus.
This pattern deploys one event bus, one subscriber, two Amazon SQS queues, one AWS Identity and Access Management (IAM) role, one log group with its log delivery, and five alarms.

< 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-bus-sqs-observability/sam

Deploy

sam deploy --guided


Testing

Publish an event and follow it through the delivery logs, then redeploy with GrantTargetAccess=false to break delivery, see the dead-letter queue and alarms report it, and replay the failed event.
See the GitHub repo for the commands and expected output.

Cleanup

Delete the replay subscriber if you created one (the variables are set in the README testing steps), otherwise the stack deletion fails: aws eventsv2 delete-subscriber --subscriber-arn "$REPLAY_ARN"
Delete the stack: sam delete --stack-name "$STACK_NAME"

Created by:

Surya Sai D

Surya Sai D

Surya works as a Technical Account Manager at AWS. He is an expert in Serverless frameworks and Event Driven Architectures. Surya is also passionate on technical writing and has contributed to AWS blogs and other Open Source Content.