Message Retention
How long an unprocessed message lives in the queue.
Controls how much grace period your consumers have before SQS deletes unprocessed work.
What it is
Message retention period defines how long Amazon SQS retains a message that has not been deleted. After the period expires, SQS automatically deletes the message regardless of whether it was processed.
- Minimum: 60 seconds.
- Maximum: 1,209,600 seconds (14 days).
- Default: 345,600 seconds (4 days).
Automatic deletion
SQS automatically deletes messages that exceed the retention period. This is independent of visibility timeout and receive count — an unprocessed message simply expires.
DLQ retention strategy
Always set DLQ retention longer than the source queue. For standard queues, DLQ age metrics reflect time since original enqueue, so messages may expire sooner than expected if retention is too short.
- Source queue: 4 days → DLQ: 14 days (recommended).
- FIFO DLQ: enqueue time resets on move — plan retention accordingly.
Monitoring
Alarm on ApproximateAgeOfOldestMessage. Steady growth indicates consumers are falling behind or messages are stuck. Combine with DLQ alarms for a complete picture.
- !Default 4 days is rarely right for a DLQ — set 14 days explicitly.
- !Unprocessed messages are silently deleted after retention — no DLQ involvement unless configured.
- !For standard DLQs, age reflects original send time, not time spent in the DLQ.