Learning/AWS SQS/29 — Hands-on Labs/Lab 11 — SQS + Lambda
Advanced outline
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

  1. Create a queue and a Lambda function; wire an event source mapping
  2. Send 10 messages; log which ones the function processes
  3. Make message #7 throw; observe all 10 redelivered and 1–6 processed twice
  4. Enable ReportBatchItemFailures and return the failed id
  5. Repeat; observe only #7 returns
  6. Set visibility timeout equal to the function timeout and observe the problem
  7. Watch the scaling curve as you flood the queue

What you should observe

  • The default is whole-batch retry — nine successful messages reprocessed
  • ReportBatchItemFailures narrows 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