Amazon EventBridge to Amazon SQS

EventBridge → SQS

Create an EventBridge rule that invokes an SQS queue.

This project contains sample AWS CDK code to create an EventBridge rule, as well as an SQS queue. The EventBridge rule publishes matched events to the SQS queue. In this example, the rule filters for specific attributes in the event before sending the event to the queue.

< 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-sqs-cdk

Deploy

cdk deploy


Testing

Use the AWS CLI to send a test event to EventBridge:
1. Send an event to EventBridge: aws events put-events --entries file://event.json.
2. Retrieve the message from the SQS queue, using the queue URL from the AWS SAM deployment outputs: aws sqs receive-message --queue-url ENTER_YOUR_QUEUE_URL.

Cleanup

1. Delete the stack: npx cdk destroy.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus".
3. You see a message confirming DELETE_COMPLETE.

Created by:

Shehryar Abbasi

Shehryar Abbasi

Senior DevOps Cloud Architect at AWS.

Follow on LinkedIn