Easy ReviewSAA-C03
Design Resilient Architectures16

SQS

Buffer work with explicit ordering, message lifetimes, duplicate handling, and controlled recovery of failed messages.

SQS separates message producers from consumers. Choose standard or FIFO delivery, then configure processing visibility, retention, and failure recovery for the work the queue carries.

Standard and FIFO queues

SQS queues buffer work between producersAn application component that sends messages to a queue., which send messages, and consumersAn application component that receives and processes queue messages., which receive and process them. Standard queues suit work that tolerates duplicate delivery and occasional reordering. FIFOAn ordering rule that preserves the sequence of messages within a message group. (first-in, first-out) queues preserve order within each message group.

How it works

  1. Choose the queue type when creating the queue. Standard is the default. Changing the type later requires a new queue; a FIFO name must end in .fifo.
  2. For FIFO, assign MessageGroupId, the identifier for one ordered sequence, to every message. Different groups can run concurrently. One group for every message creates one sequence.
  3. FIFO suppresses repeated sends with the same deduplication IDA token SQS uses to recognize duplicate FIFO sends during its deduplication interval. within five minutes. This does not make the consumer’s business operation idempotentThe property that repeating a business operation does not produce extra effects., meaning safe to repeat without extra effects. A received message can become available again if it is not deleted before visibility timeoutThe period after receiving a message during which it is hidden from other consumers..
  4. A FIFO receive can return several messages from one group. Later receives cannot take more from that group until the received messages are deleted or visible again. Different groups can progress independently.
  5. For higher FIFO throughputThe amount of queue work handled per second, measured as requests or messages., set DeduplicationScope=messageGroup and FifoThroughputLimit=perMessageGroupId. Use distinct groups for independent work so SQS can distribute it across partitionsAn SQS-managed allocation of storage holding FIFO queue messages., the storage allocations that hold queue messages. Regional quotas still apply.
Property Standard FIFO
Ordering Best effort Within each message group
Duplicate handling At-least-once deliveryDelivery in which a message can be received more than once. Duplicate sends suppressed within five minutes
Throughput Nearly unlimited API calls Partition and regional quotas
Parallel work Consumers process available work Different message groups progress independently

Exam cues

  • If the question says order per customer with parallel customers, think FIFO with a group per customer, because ordering is per group.
  • If the question says maximum queue throughput and duplicates are acceptable, think standard, because strict ordering is unnecessary for that requirement.
  • If the question says FIFO throughput needs to grow, think independent groups and high-throughput mode, because a single ordered group limits parallel work.

Remember

  • FIFO queue name: .fifo suffix. Every FIFO send needs MessageGroupId.
  • Send deduplication interval: 5 minutes.
  • Non-high-throughput FIFO: 300 transactions per second per action per partition, up to 3,000 messages per second with batching.
  • High-throughput quotas vary by Region. Transactions per second count API requests; batching increases messages per request.

Trap: FIFO’s duplicate-send suppression does not make an external payment or database update occur only once. A consumer can fail after its side effect and receive the message again.

FIFO ordering is local to a message group
ordered group A1ordered group B2FIFO group AFIFO group BConsumer AConsumer B
  1. Consumer A processes received group A records in order.

  2. Consumer B can process group B independently; there is no shared order across these groups.

From the AWS docs (14)
  • Standard SQS queues decouple request producers from consumers performing background work.
  • Standard queues are the default type and provide at-least-once delivery, best-effort ordering, and nearly unlimited API calls per second.
  • FIFO ordering applies within a MessageGroupId; different groups can be processed concurrently without a shared ordering guarantee.
  • Every FIFO message needs a MessageGroupId; using one group for all messages creates one ordered sequence.
  • A FIFO queue name must end in .fifo.
  • The queue type cannot be changed after creation; switching between standard and FIFO requires a new queue.
  • FIFO suppresses duplicate sends using the same deduplication ID within a five-minute interval.
  • A FIFO receive can contain multiple messages from one group; later receives cannot take more from that group until the received messages are deleted or visible again.
  • An SQS message not processed and deleted before visibility timeout can become available for another attempt, so duplicate business effects must be prevented.
  • Non-high-throughput FIFO partitions allow 300 transactions per second per API action; batching supports up to 3,000 messages per second per action.
  • High-throughput FIFO requires DeduplicationScope=messageGroup and FifoThroughputLimit=perMessageGroupId.
  • High-throughput FIFO request quotas vary by Region; increasing distinct message groups helps distribute work across partitions.
  • The SQS Temporary Queue Client maps many application-managed temporary queues onto one SQS queue, which cuts API calls and cost for request-response patterns.
  • SQS encrypts messages at rest with SQS-managed keys (SSE-SQS), the default for new queues, or with keys managed in AWS KMS (SSE-KMS).

Visibility, retention, and polling

SQS separates when a message becomes available, how long a consumerAn application component that receives and processes queue messages. can process it while hidden, and when it expires. Delay is the wait before the first receive. Visibility timeoutThe period after receiving a message during which it is hidden from other consumers. is the processing window after a receive. Retention is the message’s lifetime in the queue.

How it works

  1. A producerAn application component that sends messages to a queue. sends a message. Queue delay hides new messages before their first receive.
  2. The consumer calls ReceiveMessage. Short pollingA receive operation that samples some queue servers and returns immediately. samples some servers and responds immediately. Long pollingA receive operation that queries all queue servers and waits for a message or its wait deadline. queries all servers and waits for an available message or its wait deadline, reducing empty results and false-empty results, where messages exist but the response contains none.
  3. Receiving leaves the message in the queue but starts visibility timeout. Process and delete the message after success.
  4. If processing needs longer, call ChangeMessageVisibility. Extensions do not reset the maximum allowance measured from initial receipt. Set visibility to 0 to release the message immediately. An undeleted message becomes available again when visibility expires.
  5. SQS deletes messages after retention expires. A delay or a longer visibility timeout is not a replacement for choosing enough retention.
Control Starts when Default Range or maximum
Visibility timeout Message is received 30 seconds 0 seconds through 12 hours
Retention Message enters the queue 4 days 1 minute through 14 days
Queue delay Message is sent 0 seconds Up to 15 minutes
Receive wait Receive request waits 0 seconds, short polling Up to 20 seconds

Exam cues

  • If the question says two workers repeat work while one is still processing, think visibility timeout and safe duplicate handling, because the processing window may have expired.
  • If the question says reduce empty receive calls, think long polling, because it waits and queries all servers.
  • If the question says postpone a new message, think delay, because visibility only starts after receiving it.

Remember

  • Maximum visibility is 12 hours from initial receipt, including extensions.
  • WaitTimeSeconds > 0 enables long polling. The queue default ReceiveMessageWaitTimeSeconds is 0.
  • ReceiveMessage returns up to 10 messages. Individual message maximum: 1 MiB (1,048,576 bytes).
  • Changing queue delay applies to already queued FIFOAn ordering rule that preserves the sequence of messages within a message group. messages, but not to already queued standard messages.

Trap: Receiving a message does not delete it. Visibility hides it temporarily, and an undeleted message becomes available again when visibility expires.

Receiving hides a message until deletion or visibility expiry
receive and hide1success2timeout expires34AvailableConsumerDelete messageVisible again
  1. ReceiveMessage starts the processing visibility window.

  2. After processing succeeds, delete with the latest receipt handle.

  3. Without deletion, expiration of visibility makes the message available again.

  4. An available message can be received for another attempt.

From the AWS docs (14)
  • Receiving an SQS message leaves it in the queue but hides it for the visibility timeout.
  • The SQS queue visibility timeout defaults to 30 seconds and accepts 0 through 43,200 seconds, or 12 hours.
  • If a received SQS message is not deleted before visibility timeout expires, it becomes available for another receive.
  • ChangeMessageVisibility changes the timeout for a received message; setting it to zero makes the message available immediately.
  • Extending SQS visibility does not reset the 12-hour maximum measured from the initial receipt.
  • SQS retains messages for four days by default, configurable from one minute through fourteen days.
  • SQS deletes messages that remain in a queue beyond the configured retention period.
  • A queue delay hides newly sent messages before their first receive, defaults to zero, and can be up to fifteen minutes.
  • Changing queue delay affects messages already queued for FIFO but not for standard queues.
  • Short polling is the default; it samples some servers and returns immediately even if no message is found.
  • Long polling queries all servers and waits for an available message or expiration of its wait time, reducing empty and false-empty responses.
  • ReceiveMessage WaitTimeSeconds greater than zero enables long polling, up to twenty seconds; queue ReceiveMessageWaitTimeSeconds defaults to zero.
  • ReceiveMessage retrieves up to ten messages per request.
  • The maximum SQS message size is 1,048,576 bytes, or 1 MiB.

Dead-letter queues and redrive

A dead-letter queueA queue that isolates source-queue messages that repeatedly fail processing. (DLQ) isolates messages that repeatedly fail processing. A redrive policyThe source-queue policy that selects a DLQ and receive-count threshold. moves failing messages into the DLQ. A DLQ redriveThe operation that moves retained DLQ messages back to a processing queue. task moves retained messages back for another processing attempt after the cause is repaired.

How it works

  1. Create a DLQ of the same type as the source: standard to standard, FIFOAn ordering rule that preserves the sequence of messages within a message group. to FIFO. On the source queue, set RedrivePolicy with deadLetterTargetArn, the DLQ’s Amazon Resource NameThe AWS resource identifier used to identify queues in policies and redrive settings. (ARN), and maxReceiveCount, the receive-count threshold. SQS moves messages whose receive count exceeds that threshold.
  2. Inspect the failure and repair its cause. For standard queues, the original enqueue timeThe recorded time at which a message entered a queue. still controls expiration after DLQ arrival. For FIFO, moving into the DLQ resets that timestamp. Set DLQ retention longer than source retention.
  3. Start a message move task with StartMessageMoveTask or the console. Redrive returns messages to their source by default, or sends them to another queue of the same type. Start with a low custom velocity, the rate of messages moved per second, and increase while watching the source.
  4. Redriven messages can interleave with newly sent messages.
Policy or operation Configured on Purpose
RedrivePolicy Source queue Move repeatedly received messages to the DLQ
DLQ redrive task Started against the DLQ Move retained messages back for processing

Exam cues

  • If the question says repeatedly failing messages need isolation, think source RedrivePolicy, because it defines when to move them.
  • If the question says a repaired consumerAn application component that receives and processes queue messages. must reprocess DLQ backlog, think a controlled redrive task, because it returns messages at a selected rate.
  • If the question says standard DLQ messages expire unexpectedly early, think original enqueue time, because DLQ arrival does not restart that expiration clock.

Remember

  • DLQ ApproximateAgeOfOldestMessage measures age since DLQ arrival. Standard-message expiration still includes source-queue time.

Trap: Moving a failed FIFO message aside lets later business operations continue without it. Neither FIFO-to-FIFO DLQ routing nor later redrive preserves the original full business sequence.

Failure routing and recovery move messages in opposite directions
receive limit1diagnose2start redrive34Source queueDLQRepair consumerRedrive task
  1. The source policy isolates messages whose receive count exceeds maxReceiveCount.

  2. Inspect retained messages and repair the cause of processing failure.

  3. Start a controlled DLQ redrive task after repair.

  4. The task returns messages to the source for another processing attempt.

From the AWS docs (13)
  • A dead-letter queue isolates source-queue messages that could not be processed successfully for diagnosis and later processing.
  • A source queue RedrivePolicy identifies deadLetterTargetArn and maxReceiveCount; SQS moves a message when its receive count exceeds maxReceiveCount.
  • A standard source queue needs a standard DLQ; a FIFO source queue needs a FIFO DLQ.
  • Moving failed messages out of a FIFO queue can break the exact business-operation order.
  • The default allowAll permits source queues in the same account and Region; byQueue allows up to ten specified source ARNs.
  • A standard message retains its original enqueue timestamp when moved to a DLQ, so time spent in the source counts toward expiration.
  • A FIFO message enqueue timestamp resets when it moves to a DLQ.
  • ApproximateAgeOfOldestMessage on a DLQ measures time since arrival in the DLQ rather than original send time.
  • AWS recommends DLQ retention longer than source-queue retention.
  • A DLQ redrive task moves messages back to their source queue by default, or to another queue of the same type.
  • StartMessageMoveTask starts a DLQ redrive task, ListMessageMoveTasks lists tasks, and CancelMessageMoveTask cancels a running task.
  • Custom max redrive velocity is at most 500 messages per second; AWS recommends starting slowly and increasing while monitoring the source.
  • Redriven messages can interleave with new producer messages in the destination, including a FIFO destination.

Flashcards

tap to flip
Answer

·

All 16 cards as a list

How do SQS standard and FIFO queues differ in delivery, ordering, and baseline throughput?

Standard provides at-least-once delivery, best-effort order, and nearly unlimited API calls. FIFO orders within each MessageGroupId and deduplicates sends for five minutes. Non-high-throughput FIFO partitions allow 300 transactions per second per action, or up to 3,000 messages per second with batching.

Does SQS FIFO send deduplication make consumer side effects safe from repetition?

No. Deduplication suppresses duplicate sends within five minutes. A received message can be processed again if it is not deleted before visibility timeout, so consumers still need idempotent business operations.

An SQS workload needs order per customer but parallel processing across customers. How should it use FIFO message groups?

Use a MessageGroupId per customer. FIFO preserves order inside each group while different groups can be processed concurrently.

A standard SQS queue must provide strict ordering for related messages. Can the team enable FIFO on the existing queue?

No. Create a FIFO queue, whose name ends in .fifo, and send related messages with the same MessageGroupId. Queue type cannot be changed after creation.

Which SQS FIFO attributes enable high-throughput mode?

Set DeduplicationScope to messageGroup and FifoThroughputLimit to perMessageGroupId. Distribute independent work across distinct message groups.

Thousands of short-lived clients each need a reply queue in a request-response pattern, and creating real SQS queues per client is slow and costly. What fits?

SQS temporary queues through the Temporary Queue Client, which maps them onto one SQS queue.

Pro users jobs must be processed before lite users jobs. How can SQS standard queues provide that priority?

Use two queues, one per class, and have the workers poll the pro queue first. A standard queue has only best-effort ordering, so one queue cannot rank messages.

A queue must use encryption keys whose use the security team can audit and restrict. SSE-SQS or SSE-KMS?

SSE-KMS, which uses keys in AWS KMS that the team controls through key policies. SSE-SQS keys are managed by SQS itself.

What SQS timer, polling, and message limits should a consumer design account for?

Visibility defaults to 30 seconds, with a 0-to-12-hour range. Retention defaults to four days, with a one-minute-to-fourteen-day range. Initial delay is at most fifteen minutes; long polling waits at most twenty seconds. Messages are at most 1 MiB and a receive returns up to ten.

An SQS worker is still processing when its message becomes visible and another worker receives it. Which setting should it adjust?

Increase visibility timeout or extend it using ChangeMessageVisibility while processing. Delete the message after success. Changing initial delay does not protect work already received.

An SQS application makes many receive calls with empty results even while some messages exist. What should it enable?

Enable long polling with a positive WaitTimeSeconds, up to twenty seconds. It queries all servers and reduces empty and false-empty responses.

A worker repeatedly extends SQS message visibility. Does each extension begin a new twelve-hour allowance?

No. The twelve-hour maximum is measured from initial receipt; extending visibility does not reset it.

Repeatedly failing SQS messages consume retries. How should the team isolate them, and what is the FIFO ordering risk?

Set the source queue RedrivePolicy with its deadLetterTargetArn and maxReceiveCount. Standard must target standard, and FIFO must target FIFO. Removing a failed FIFO message can break the exact business-operation order.

A standard SQS message spends time in its source queue before reaching a DLQ. Does its expiration clock restart on DLQ arrival?

No. The original enqueue timestamp remains, so source-queue time counts toward expiration. Use a DLQ retention period longer than the source retention. FIFO messages reset their enqueue timestamp on DLQ arrival.

A team has repaired the consumer that caused SQS messages to accumulate in its DLQ. How can it reprocess the backlog safely?

Start a DLQ redrive with StartMessageMoveTask or the console, targeting the source or another same-type queue. Begin with a low custom velocity and monitor the source as the rate increases.

A DLQ age metric looks young, but standard SQS messages expire sooner than expected. Why?

ApproximateAgeOfOldestMessage measures time since DLQ arrival, while standard-message expiration still uses the original enqueue timestamp.

You finished every topic of SAA-C03!

Your badge turned gold. Next step: book the exam on AWS. Once you pass, add yourself to Who passed.

Share

Share that you finished this certification

I finished every topic of AWS Certified Solutions Architect - Associate (SAA-C03) on Easy Review. Come study too!