SQS
Solution Architect Associate
Developer Associate
- First ever AWS service publically available
- Web service that gives you access to a message queue
- Always a pull based system (may be on the exam!)
- Any component can retrieve the messages programatically using the SQS API
- Message based API (know this for exam!!)
- Queue depth can be a trigger for autoscaling, CloudWatch alarms, etc. Helpful to spin up instances to respond to queue messages
Standard Queues
- Guaranteed that all messages are delivered at least once, however occasionally messages may be delivered out of order.
- Allows nearly unlimited transactions per seconds.
- SQS Standard queues offer best effort ordering, but it could duplicate messages and they are likely delivered in a different order that they went in. This is on you to handle
FIFO Queues
- Guarantee that message will be received in the order in which they are sent.
- Messages are delivered once, and remain available until a consumer processes and deletes it.
- Limited to 300 transactions per second
- A little more expensive than Standard Queues
SQS Visibility Timeout
- The amount of time that a message is invisible in the SQS Queue after a reader picks up the message. Provided the job is processed before the visibility timeout expires, the message will then be deleted from the queue. If not, the message again becomes available for another reader to process it.
- Default timeout is 30 seconds, maxiumum is 12 hours (know for exam!!)
Important Settings to Know About
- SQS Messages are encrypted in transit by default. They can be encrypted at rest through configuration, but are not by default (know for exam!!)
- Messages can remain in the queue up to 14 days, but the default is 4 days (know for exam!!)
- Long polling is not the default, it must be configured (know for exam!!). You almost always want to use long polling even though its not default
- Messages contain up to 256 KB of text in any format (know this for exam!!)
- Can use a Delivery Delay to postpone the delivery of new messages to a queue for a number of seconds.
Dead-Letter Queues
- An SQS Queue that allows you to temporarily sideline messages into once you’ve hit a number of specified retries without a successful processing of the message
- You have to create the DLQ before you create the primary queue
- When specifying a DLQ, you also specify a maximum recevies before the message is sent to the DLQ
- You can create a DLQ for SNS topics