| Service Name: | Simple Queue Service (SQS) |
| ARN Format: | arn:aws:sqs:{region}:{account}:{name of queue} |
| Style: | Async (Write) |
| Actions (required Permissions): |
sqs:GetQueueUrl,sqs:SendMessage (grants access to sqs:SendMessageBatch as well)
|
| Payload Format: | JSON Packet, one message per packet |
| Arguments: |
SendRaw (boolean, default: false),UseMessageAttributes (boolean, default: false),MessageGroupIdExpression (binary range expression, optional),MessageGroupIdFormatter (string, default: "hex"),MessageDeduplicationIdExpression (binary range expression, optional),MessageDeduplicationIdFormatter (string, default: "hex")
|
Proxylity's integration with SQS writes batches of packets arriving at your listener as messages to your queue. Writing packets to SQS allows delayed handling for moderate to high rate workloads, decoupling packet receipt from processing and enabling horizontal scaling of your backend systems. Standard, FIFO, and Fair queues are all supported with specialized configuration options for ordering and deduplication.
UDP Gateway uses the sqs:SendMessageBatch API to efficiently write packets to your queue. This
batch API allows up to 10 messages to be sent in a single API call, reducing costs and improving throughput
when handling high packet rates.
Important: While UDP Gateway batches packets for efficient transmission to SQS, each SQS message contains exactly one packet. When your application receives messages from the queue, each message body will be a single JSON packet object, not an array. This design ensures that individual packets can be processed independently, retried separately if processing fails, and distributed across multiple consumers for parallel processing.
The message body contains the complete request packet with all metadata including source/destination addresses, arrival time, and the UDP payload data. Your queue consumers can process these messages using standard SQS polling techniques, Lambda event source mappings, or any other SQS-compatible processing framework.
The SQS destination supports two configuration options that control how packet data is formatted in queue messages:
SendRaw (boolean, default: false) - When set to true, the raw binary UDP
payload is sent as the message body without JSON wrapping. When false (default), the message body
contains the full JSON packet object with metadata.
UseMessageAttributes (boolean, default: false) - When set to true, packet
metadata (source IP/port, destination IP/port, timestamp, etc.) is sent as SQS message attributes instead of
being
included in the JSON body. This option is only meaningful when SendRaw is false.
SQS FIFO queues preserve the order of messages and provide exactly-once processing, making them ideal for scenarios where packet ordering matters. AWS Fair queues provide fair processing across message groups with improved throughput compared to FIFO queues. UDP Gateway provides specialized configuration options for working with both queue types.
Both FIFO and Fair queues require a message group ID. For FIFO queues, the message group ID provides ordering guarantees within each group. For Fair queues, it enables fair processing distribution across groups. UDP Gateway supports two approaches for specifying the message group ID:
MessageGroupIdExpression is configured, all packets
use the same message group ID, ensuring strict ordering across all packets (FIFO) or treating all messages
as a single processing group (Fair).Arguments.MessageGroupIdExpression to a binary
range expression (e.g., "[0:4]") that extracts bytes from each packet's payload. Optionally
specify Arguments.MessageGroupIdFormatter to control how the extracted bytes are converted to
a string—options are "hex" (default), "ascii", "utf8", or
"base64". For FIFO queues, this enables ordering within logical groups while allowing parallel
processing across different groups. For Fair queues, this ensures fair processing distribution across
different groups.
FIFO queues support content-based deduplication to prevent duplicate message processing. UDP Gateway allows you to dynamically extract deduplication IDs from packet payloads:
MessageDeduplicationId which overrides the content-based deduplication setting on queues. If
you want to deduplicate messages based on their full content, set the
MessageDeduplicationIdExpression to the full binary range expression "[:]".MessageDeduplicationIdExpression is not
set, a random value will be assigned to the MessageDeduplicationId to effectively disable FIFO
deduplication while maintaining strict ordering. This can be helpful for protocols that include
content-identical messages like heartbeats.Arguments.MessageDeduplicationIdExpression to a
binary range expression (e.g., "[4:8]") that extracts bytes from each packet's payload.
Optionally specify Arguments.MessageDeduplicationIdFormatter to control encoding—options are
"hex" (default), "ascii", "utf8", or "base64". This is
useful when your UDP protocol includes unique transaction or sequence identifiers.
{
"DestinationArn": "arn:aws:sqs:us-east-1:123456789012:my-queue.fifo",
"Arguments": {
"MessageGroupIdExpression": "[0:4]",
"MessageGroupIdFormatter": "hex",
"MessageDeduplicationIdExpression": "[4:8]",
"MessageDeduplicationIdFormatter": "hex"
}
}
This configuration extracts the first 4 bytes as the message group ID and bytes 4-8 as the deduplication ID, both formatted as hexadecimal strings.
sqs:GetQueueUrl and sqs:SendMessage.
An example demonstrating both Standard and FIFO queue configurations is available in the SQS example in our GitHub examples repository. The example includes CloudFormation templates showing how to configure both queue types with different delivery options.