SQS queue settings, FIFO options and encryption

The SQS queue attributes that change behaviour — retention, visibility, delay, receive wait time, RedrivePolicy and RedriveAllowPolicy, FIFO content-based deduplication and high-throughput mode — and encryption with SSE-SQS or SSE-KMS, including the customer managed key policy SNS, EventBridge and S3 need to deliver into an encrypted queue, the producer and consumer KMS permissions, and the data-key reuse period.

markdownreferencev4MC7Q-TYGRstage: referencetrust: officialservice: sqsinterface: anySQS queue attributesMessageRetentionPeriodVisibilityTimeoutDelaySecondsReceiveMessageWaitTimeSecondsRedrivePolicyRedriveAllowPolicy byQueueContentBasedDeduplicationDeduplicationScopeFifoThroughputLimit perMessageGroupIdhigh throughput FIFOSSE-SQSSqsManagedSseEnabledSSE-KMS SQSKmsMasterKeyIdKmsDataKeyReusePeriodSecondsaws/sqs managed key SNSSQS key policy events.amazonaws.coms3.amazonaws.comsns.amazonaws.comSQS queue policy

Created 18 Oct 2026 · Modified 23 Oct 2026 · 4 versions

If an AWS service (SNS, EventBridge, S3) writes into your queue, use SSE-SQS or a customer managed KMS key, never the AWS managed aws/sqs key. The aws/sqs key's policy can't be edited to admit those services, and their messages silently fail to arrive.

Attributes

AttributeRange (default)Notes
MessageRetentionPeriod60 s – 14 days (4 days)A DLQ needs longer retention than its source
VisibilityTimeout0 s – 12 h (30 s)A Lambda trigger needs ≥ 6 × the function timeout (patterns/sqs-to-lambda.md)
DelaySeconds0 – 15 min (0)Delays new messages
ReceiveMessageWaitTimeSeconds0 – 20 s (0 = short polling)Set 20 for long polling by default
RedrivePolicyJSON string: deadLetterTargetArn, maxReceiveCount (default 10)The DLQ must be in the same account and Region
RedriveAllowPolicy (on the DLQ)JSON string: redrivePermission allowAll (default) / denyAll / byQueue + sourceQueueArns (≤10)Controls which queues may use this one as their DLQ
ContentBasedDeduplication (FIFO)true / falseThe deduplication ID is a SHA-256 of the body (attributes excluded)
DeduplicationScope (FIFO)messageGroup / queueHigh throughput: set messageGroup…
FifoThroughputLimit (FIFO)perQueue / perMessageGroupId…and perMessageGroupId, which is only allowed with messageGroup scope
SqsManagedSseEnabledtrue / falseSSE-SQS (keys owned by SQS). Only one SSE option per queue
KmsMasterKeyIdkey ID or alias (alias/aws/sqs for the AWS managed key)SSE-KMS
KmsDataKeyReusePeriodSeconds60 – 86,400 (300)Longer means fewer KMS calls; shorter means tighter key rotation

Changes apply with aws sqs set-queue-attributes --queue-url <url> --attributes '{…}'. JSON-valued attributes (RedrivePolicy, RedriveAllowPolicy, Policy) are strings containing JSON.

Encryption choices

OptionWho can sendCost and complexity
SSE-SQS (SqsManagedSseEnabled: true)Anyone the queue policy and IAM allow; no KMS permissions involvedNo KMS calls
SSE-KMS with aws/sqsYour own principals with IAM KMS permissions. Not SNS, EventBridge or S3KMS calls
SSE-KMS with a customer managed keyAnyone allowed by the key policy and the queue policy, including AWS servicesKMS calls; you manage the key policy

Key policy statement for service producers

Add one statement per producing service, with a confused-deputy condition:

{
  "Effect": "Allow",
  "Principal": { "Service": "sns.amazonaws.com" },
  "Action": ["kms:Decrypt", "kms:GenerateDataKey"],
  "Resource": "*",
  "Condition": { "ArnEquals": { "aws:SourceArn": "arn:aws:sns:<region>:<account-id>:<topic>" } }
}

Use events.amazonaws.com with the rule ARN for EventBridge, and s3.amazonaws.com with the bucket ARN for S3. The SQS page names aws:SourceArn or aws:SourceAccount; the condition block above is the hub's composition. The SNS guide's own example (patterns/sns-to-sqs-fanout.md) grants kms:GenerateDataKey* without a condition.

Principals in your account

  • Producers need kms:GenerateDataKey and kms:Decrypt each time the data-key reuse period expires.
  • Consumers need kms:Decrypt. DLQ consumers also need it on the source queue's key.
  • KMS calls scale with the number of distinct principals: per period, (billing period ÷ reuse period) × (2 × producers + consumers).

KMS errors and key states: reference/kms/key-policies-and-errors.md. SQS-side names (KmsAccessDenied, KmsDisabled, …): reference/sqs/errors.md.

Read this document as markdown — the same bytes an agent receives.