Amazon EventBridge to Amazon SQS

EventBridge → SQS

Create an EventBridge rule that invokes an SQS queue.

This template deploys an SQS queue that is triggered by an EventBridge rule. The SQS queue policy provides the permission for EventBridge to send messages to the SQS queue.
In this example, the EventBridge rule specified in main.tf filters the events based upon the criteria in the aws_cloudwatch_event_rule block. When matching events are sent to EventBridge that trigger the rule, they are delivered as a JSON event payload (see "Example event payload from EventBridge to SQS" in the README) to the SQS 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-terraform

Deploy

See the GitHub repo for detailed deployment instructions.


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. Change directory: cd eventbridge-sqs-terraform.
2. Delete the stack: terraform destroy.
3. Confirm the stack has been deleted: terraform show.

Created by:

Ahmad Aboushady

Ahmad Aboushady

Senior Technical Account Manager, AWS