What is the RedriveAllowPolicy attribute on an Amazon SQS queue, and what does its redrivePermission setting control?
answer
- the target side of the relationship
- the source declares it unilaterally today
- three words: all, none, or a list
- protects an alarm's meaning, not an API
- not the same as running a replay
basics
~20 sRedriveAllowPolicy is set on a queue acting as a dead-letter queue and declares which source queues may name it as their DLQ. Its redrivePermission field takes allowAll, denyAll, or byQueue with an explicit list of source queue ARNs.
solid answer
~50 sIt is the target-side counterpart to `RedrivePolicy`. `RedrivePolicy` lives on a source queue and points at a DLQ; `RedriveAllowPolicy` lives on the DLQ and says who is allowed to point at it. The `redrivePermission` field takes three values: `allowAll`, the default, meaning any queue in the same account and Region may use it as a dead-letter queue; `denyAll`, meaning none may — useful when a queue is being retired as a DLQ or should never be one; and `byQueue`, which pairs with a `sourceQueueArns` list naming exactly the queues permitted. It exists because the DLQ relationship is declared unilaterally by the source, so without this attribute an unrelated team could quietly start dumping their failures into your queue, mixing their messages with yours and muddying your alarms and replay. Note it governs who may *use* the queue as a DLQ — it is unrelated to running a message move task.
code
json · 7 lines{
"redrivePermission": "byQueue",
"sourceQueueArns": [
"arn:aws:sqs:us-east-1:111122223333:orders",
"arn:aws:sqs:us-east-1:111122223333:orders-priority"
]
}go deeper
Recall that RedriveAllowPolicy sits on the dead-letter queue and its redrivePermission takes allowAll, denyAll, or byQueue.
Explain why it exists: the DLQ relationship is declared unilaterally by the source queue, so without it any queue in the account and Region can attach to yours, and the attribute is enforced at configuration time.
Frame it as protecting operational ownership — a DLQ alarm only means something if exactly one known set of sources feeds the queue, and a replay is only safe if you know whose messages you are moving.
Decide the estate convention: denyAll on work queues, byQueue on shared service DLQs, and treat pressure against the sourceQueueArns list as a signal that a DLQ is serving too many owners and should be split.
## The asymmetry it fixes The dead-letter relationship in SQS is declared in one place only: the source queue's `RedrivePolicy`, naming a `deadLetterTargetArn`. The target queue is not consulted and its own attributes carry no trace of who points at it. In a single-team account that is harmless. In a shared account it is a real problem — any queue owner in the same account and Region can name your queue as their dead-letter queue, and the first you learn of it is unfamiliar messages appearing in a queue you thought you understood. `RedriveAllowPolicy` closes that gap. It is a queue attribute set on the *target*, and it is a small JSON document: ```json { "redrivePermission": "byQueue", "sourceQueueArns": [ "arn:aws:sqs:us-east-1:111122223333:orders", "arn:aws:sqs:us-east-1:111122223333:orders-priority" ] } ``` ## The three permission modes **`allowAll`** is the default, and it is what every queue has unless you say otherwise. Any queue in the same account and Region may set this queue as its dead-letter target. Convenient, and fine for a queue whose only job is to be a DLQ for one service. **`denyAll`** forbids all of it. This is the right setting on ordinary work queues that should never accidentally become somebody's DLQ, and on a queue you are decommissioning as a DLQ once you have drained it — it stops new sources attaching while you finish the migration. **`byQueue`** is the explicit allow-list. It requires a `sourceQueueArns` array naming the exact queues permitted, and it is the mode to use for a shared DLQ that legitimately serves several sources within one service. The list is bounded, so `byQueue` is not a scaling mechanism for dozens of sources; if you find yourself pressing against the limit, that is a signal the DLQ is serving too many owners and should be split. Attempting to set a `RedrivePolicy` that the target's `RedriveAllowPolicy` forbids fails, so enforcement happens at configuration time rather than silently at runtime. ## Where it fits operationally The reason to care is not primarily security — an SQS queue policy already governs who can call the SQS APIs, and this attribute is not an IAM policy. It is about **operational ownership**. A dead-letter queue is only useful if the presence of a message in it means one specific, well-understood thing: "a message from *my* pipeline failed repeatedly". As soon as a second, unrelated source is dumping into the same queue, your "any message is an incident" alarm starts paging you for someone else's failures, and a replay task risks moving their messages into your source queue. `byQueue` keeps that invariant enforced by the platform rather than by convention. ```bash aws sqs set-queue-attributes \ --queue-url https://sqs.us-east-1.amazonaws.com/111122223333/orders-dlq \ --attributes '{"RedriveAllowPolicy":"{\"redrivePermission\":\"byQueue\",\"sourceQueueArns\":[\"arn:aws:sqs:us-east-1:111122223333:orders\"]}"}' ``` As with `RedrivePolicy`, the value is passed as a JSON string, which is a frequent source of confusion when writing it by hand. ## The name trap The word "redrive" appears in three distinct SQS concepts and candidates conflate them constantly: - `RedrivePolicy` — on the source queue: where failures go, and after how many deliveries. - `RedriveAllowPolicy` — on the target queue: who is allowed to send failures here. - The message move task (`StartMessageMoveTask`) — the operation that replays messages *out of* a DLQ. Only the third one moves any message. The first two are configuration, and `RedriveAllowPolicy` in particular does not grant, restrict, or otherwise touch permission to run a replay — that is governed by ordinary IAM permissions on the SQS API. Getting these three straight in one sentence is a cheap way to sound like you have operated this rather than read about it.
- Does RedriveAllowPolicy control who may run a redrive task on the queue?No — that is the name trap. It controls only which source queues may nominate this queue as their dead-letter target. Permission to call `StartMessageMoveTask`, `ListMessageMoveTasks`, or `CancelMessageMoveTask` comes from ordinary IAM policy on the caller, plus any queue policy on the queues involved.
- On which kind of queue would you set denyAll, and why?On ordinary work queues that should never become somebody's dead-letter target, and on a DLQ you are retiring — once drained, denyAll stops new sources attaching while you finish the migration. Since allowAll is the default, denyAll is the deliberate act that makes "this queue is not a DLQ" true rather than merely assumed.
saying these in an interview costs you the question
- Confuses RedriveAllowPolicy with the redrive replay operation
- Thinks it is set on the source queue alongside RedrivePolicy
- Assumes the default is restrictive rather than allowAll
- Describes it as an IAM policy governing SQS API calls
- Believes byQueue scales to arbitrarily many source queues