This chapter is an outline. The curriculum, learning objectives and
structure are settled; the prose, diagrams and code are still being written.
What is below is the plan for the chapter, not the chapter.
Lab 11 — SQS + Lambda
Goal
The whole-batch-retry bug in its natural habitat, then the fix.
Setup
To be written — CLI commands and an IaC equivalent for every resource, all prefixed sqs-course-.
Steps
- Create a queue and a Lambda function; wire an event source mapping
- Send 10 messages; log which ones the function processes
- Make message #7 throw; observe all 10 redelivered and 1–6 processed twice
- Enable
ReportBatchItemFailuresand return the failed id - Repeat; observe only #7 returns
- Set visibility timeout equal to the function timeout and observe the problem
- Watch the scaling curve as you flood the queue
What you should observe
- The default is whole-batch retry — nine successful messages reprocessed
ReportBatchItemFailuresnarrows it to the actual failure- The Lambda service is doing the polling; you can see it in the SQS request metrics
Why it happened
To be written — ties each observation back to the mechanism in 19 — SQS and AWS Lambda.
Experiments to try
To be written — deliberate variations that change the outcome.
Teardown
To be written — every resource created above, in dependency order.
← Back to: 29 — Hands-on Labs