Amazon EventBridge to Amazon SQS

EventBridge → SQS

Create an EventBridge rule that invokes an SQS queue.

The Serverless Framework 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 the template filters the events based upon the criteria in the EventPattern section. When matching events are sent to EventBridge that trigger the rule, they are delivered as a JSON event payload 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-sls

Deploy

serverless deploy --verbose


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: serverless remove --verbose.
2. Confirm the stack has been deleted: aws cloudformation list-stacks --query "StackSummaries[?contains(StackName,'STACK_NAME')].StackStatus"

Created by:

Dmitry Gulin

Dmitry Gulin

Modernization Architect, AWS

Follow on LinkedIn