Quizzes · Compute · Level 0
SQS (Simple Queue Service)
A managed queue. One part of your system drops messages in, another takes them out later.
Think of it as: A ticket rail in a restaurant kitchen. Waiters clip orders up, cooks take them down when ready.
What to know for Level 0
- A queue decouples sender and receiver: the sender drops a message and moves on. Bursts wait safely instead of overloading the database, and slow work happens in the background.
- Messages wait 4 days by default, up to 14, so a worker can be down for a while without anything being lost.
- A received message is hidden for the visibility timeout, not deleted. If the worker doesn't delete it in time, it reappears and is retried.
- Standard queues deliver at least once (occasionally twice) and not always in order, so workers must be idempotent. FIFO queues keep strict order and process each message exactly once.
- Sending and receiving are AWS API calls approved by IAM, for example
sqs:SendMessage on the queue's ARN.
What to know for Level 2
- FIFO queues keep order within a message group and process each message exactly once, with lower throughput than standard queues. Standard queues are nearly unlimited but may reorder and duplicate.
- Long polling (WaitTimeSeconds up to 20) makes a receive call wait for messages instead of returning empty, cutting empty responses and cost.
- A delay queue (or a per-message delay) hides new messages for up to 15 minutes before consumers can see them.
- Queue depth (ApproximateNumberOfMessagesVisible) is the classic metric for scaling workers: more messages waiting, more workers.
- SQS encrypts messages at rest by default with keys SQS owns (SSE-SQS). Choose SSE-KMS to use a KMS key you control: its key policy, its rotation, and CloudTrail records of each use. SNS topics can be encrypted with KMS the same way.
- Another AWS service or account can send to a queue only if the queue's access policy allows it, naming the sender (for example s3.amazonaws.com, sns.amazonaws.com or events.amazonaws.com) and usually a condition such as aws:SourceArn. An IAM policy on the uploader or publisher is not what delivers a service's events into the queue.
More detail
Queues decouple systems: the sender doesn’t wait for, or even know about, the receiver. Messages wait for up to 14 days. When a consumer takes a message it becomes invisible for the visibility timeout; if it isn’t deleted in time, it reappears and gets retried. Standard queues are fast with at-least-once delivery. FIFO queues keep strict order and deliver exactly once.
Quiz yourself on SQS (Simple Queue Service) →Study flash cards
← All quizzes