View and re-drive messages in SQS Dead-letter queue (DLQ) via AWS Console

1.2k Views Asked by At

I want to view and re-drive failed messages lying around in my SQS dead-letter queue (DLQ). Can it be done directly via AWS Console?


PS: In Dec 2021, AWS announced ability to re-drive failed messages in DLQ. While I'm aware that as of June 2023 programmatic re-drive is also available via AWS SDK / CLI, for my current use-case I'm more interested in a quick manual way to re-drive

1

There are 1 best solutions below

0
y2k-shubham On

I played around with SQS section of AWS console and here are my anecdotal findings (please correct me if I'm wrong, incomplete somewhere)

  1. The home page of SQS lists all the 'main' queues as well as their configured dead-letter queues. For e.g. in following screenshot we see 2 pairs of main queues & corresponding DLQs. So goto SQS and under list of queues find the respective DLQ on which re-drive needs to be performed. The same page also shows the no of messages in queue

    • Messages available > 1 in DLQ implies some request(s) failed to process, despite (say) 3 attempts that are configured against main queue by default; ref: ApproximateReceiveCount
    • Messages in flight: This refers to no of messages that are lying around in queue that have been read by consumer (e.g. lambda) but not committed yet. This provision exists so that if the consumer crashes or times-out in acknowledging the successful processing of message, then SQS puts that message back in the queue for another processing attempt. This cycle repeats max of 3 times (configurable) before SQS gives up and moves the message to DLQ which then requires a manual re-drive
    • Few seconds after we trigger re-drive of messages (discussed below), the Messages available in DLQ decreases by 1 (since 1 message moves from DLQ to corresponding main queue) and that message temporarily shows up as Messages in flight under main queue (since it is being processed by our lambda). If for any reason processing fails again, then message is once again put back in DLQ so that Messages available for DLQ again increases by 1 and we are essentially back to where we started
  2. Click on the name of DLQ and in the page that opens

    • To visualize stats of messages in queue: Check ‘Monitoring’ tab to see graphs that depict things like max age of message lying around in queue, no of messages etc.
      • To change time-window, granularity or auto-refresh interval of graphs, use the controls panel given above the graphs
      • Individual graphs can also be viewed in metrics for more fine-grained visualization
    • To view contents of the message lying around in queue: Click on Send and receive messages button on the top right corner & in the following screen click on Poll for messages button
    • To re-drive messages in queue: Click on Start DLQ redrive button and in the following screen click on the orange DLQ redrive button in bottom right of page (no need to change any settings for redrive).
      • Tip: This is the only action that requires Admin access to AWS Console, remaining things discussed in this answer can be done via Read-only access

Image-1: AWS Console SQS page showing main queue & DLQ pairs for SandFire & AEDU Image-1: AWS Console SQS page showing main queue & DLQ pairs for SandFire & AEDU

Image-2: (1) View ‘Monitoring’ tab for stats around queue & (2) visit Send and receive messages to View messages. (3) Click on Start DLQ redrive to trigger a re-drive of messages (requires confirmation by clicking on Redrive DLQ button on the next screen) enter image description here

Image-3: View messages by clicking on Poll for messages button Image-3: View messages by clicking on Poll for messages button

Image-4: Re-drive messages by clicking on DLQ redrive button (no need to change any settings) mage-4: Re-drive messages by clicking on DLQ redrive button (no need to change any settings)