AWS's managed queue service.
## Using FIFO queues
These attributes are returned in the event payload of FIFO SQS messages to the consuming Lambda function:
- **MessageGroupID**: this required field enables multiple message groups within a single queue. If you do not need this functionality, provide the same MessageGroupId value for all messages. Messages within a single group are processed in a FIFO fashion.
- **MessageDeduplicationID**: this token is used to deduplicate messages within a 5-minute interval. If two messages with the same MessageDuplicationID are sent, both messages are accepted successfully but only one is delivered.
> Amazon SQS FIFO queues ensure that the order of processing follows the message order within a message group. However, **it does not guarantee only once delivery when used as a Lambda trigger**.
### Worked example
Consider the use case where our application has to deliver emails exactly once using SES. SES has no built-in de-duplication mechanism.
The solution here is:
- Use a FIFO queue, not for ordering, but solely for the deduplicationId
- When writing to queue, set the deduplicationId to a hash of the emailmessage (including To, From, etc), groupID can be constant.
- New DDB table "EmailsSent", with PK of deduplicationId.
- Lambda handler logic (invoked with a full batch size):
- Check DDB for item with deduplicationId
- If not present:
- Send email using SES
- Write item to DDB
- Delete message from queue
---
## References
- https://aws.amazon.com/blogs/compute/new-for-aws-lambda-sqs-fifo-as-an-event-source/