Amazon Web Services
AWS-09 intermediate
Event-driven order processing with SQS, SNS, a dead-letter queue and EventBridge
Decouple an order system: an SNS topic fans out to an SQS queue, you receive and delete messages by hand, then a Lambda function consumes the queue, a poison message lands in the dead-letter queue, and an EventBridge rule routes OrderPlaced events to Lambda.
What you'll do
- Create standard queues with a redrive policy (DLQ)
- Publish to an SNS topic and fan out to SQS
- Understand visibility timeout, receive and delete
- Connect SQS to Lambda with an event source mapping and the right IAM policy
- Route events with an EventBridge rule and event pattern
Lab tasks
-
1
Create the dead-letter queue
orders-dlq -
2
Create
orders-queuewith a redrive policy -
3
Create the SNS topic
order-events - 4 Subscribe the queue to the topic
- 5 Publish an order and receive it from the queue
- 6 Delete the processed message
- 7 Let Lambda consume the queue
- 8 Send a poison message to the DLQ
- 9 Create an EventBridge rule for OrderPlaced events
- 10 Send an event and watch it routed