Visual overview
SNS can fan out events into independent SQS queues; Lambda can scale consumers while SQS buffers work.
Technical reference
SQS behavior is controlled by delivery semantics and queue/message timers. Concrete timer and throughput limits can change, so confirm current AWS quotas for production designs.
A message can be delivered more than once; processing code should be idempotent and order-independent unless the application imposes its own controls.
A received message is hidden while in flight. The consumer can change visibility when processing duration requires it; AWS documents an upper bound for total visibility.
Long polling waits for a message instead of immediately returning an empty response; AWS currently documents a maximum wait of 20 seconds.
The source queue's redrive policy determines how many receives can occur before SQS moves a repeatedly failing message to the configured DLQ.
Ordering is strict within a group; using multiple well-distributed groups enables parallel processing across groups.
FIFO queues track deduplication identifiers for a documented window and suppress duplicate sends during that interval.
Service limits and capabilities can change. Values shown here reflect the current AWS documentation; use the linked official sources below as the source of truth.
SQS decouples producers from consumers with a durable queue
Amazon Simple Queue Service (SQS) stores messages until consumers receive and delete them, allowing producers and consumers to run at different rates and fail independently. This is a pull-based decoupling pattern: consumers call ReceiveMessage or a managed integration polls on their behalf. The queue absorbs temporary bursts so a downstream worker fleet can process work according to available capacity.
Standard queues provide at-least-once delivery and best-effort ordering. Applications using them must therefore make processing idempotent and tolerate messages arriving more than once or in a different order. FIFO queues add strict ordering within each message group and deduplication semantics for workloads that require ordered processing, trading some flexibility for stronger delivery behavior.
Visibility timeout coordinates in-flight work
When a consumer receives a message, SQS marks it in flight and hides it from other consumers for the visibility timeout. If processing completes, the consumer deletes the message using its receipt handle. If processing fails or takes longer than the visibility period without an extension, the message can become visible again and another consumer may receive it. Visibility is therefore a temporary lease, not a lock that proves processing succeeded.
The timeout should cover normal processing time while still allowing failed work to return to the queue promptly. Consumers can change a message's visibility while processing when duration is variable. With Lambda event-source mappings, the queue visibility setting must also be chosen around the function timeout and retry behavior according to Lambda's SQS integration guidance.
- Visibility timeout starts when a message is received.
- DeleteMessage is the acknowledgement that removes successfully processed work.
- Long polling waits for messages and reduces empty/false-empty receive responses.
- Delay queues hide newly sent messages; visibility timeout hides already received messages.
DLQs isolate poison messages; FIFO groups define ordering scope
A source queue can use a redrive policy with a dead-letter queue. After a message has been received unsuccessfully enough times to cross the configured maxReceiveCount, SQS moves it to the DLQ. This prevents a repeatedly failing message from consuming normal processing cycles forever and gives operators a place to inspect, correct, or redrive problematic work. AWS requires the DLQ to use the same queue type as its source and recommends keeping it in the same account and Region.
For FIFO queues, MessageGroupId is the ordering boundary. Messages in one group are processed in strict sequence, while different groups allow parallelism. MessageDeduplicationId or content-based deduplication prevents duplicate sends within the FIFO deduplication window. This is not a reason to abandon idempotency: applications can still experience retries and downstream side effects, so business operations should be safe to repeat where practical.
Key takeaways
- 01
Standard SQS queues are at-least-once with best-effort ordering; consumers should be idempotent.
- 02
Visibility timeout hides a received message temporarily; successful work must still delete it.
- 03
Long polling reduces empty receive responses and unnecessary polling activity.
- 04
A DLQ isolates messages that repeatedly exceed the source queue's configured receive-attempt threshold.
- 05
FIFO ordering is scoped by MessageGroupId, enabling parallelism across different groups.
Official AWS sources
Use these primary AWS resources for the source material behind this article and for deeper reference.