Amazon SQS Channel Binding v0.3.0
The Amazon SQS channel binding object defines the configuration for an SQS queue. This binding allows you to specify detailed properties for both the main queue and an associated dead-letter queue (DLQ).
Overview
This binding consists of two main parts: the queue
and the optional deadLetterQueue
. Both are defined using a common queue
object structure, allowing you to configure properties like queue type (FIFO or standard), message retention, and access policies.
Queue Object Properties
This object defines the properties of an SQS queue, used for both queue
and deadLetterQueue
.
Property | Type | Default | Description |
---|---|---|---|
name | string | - | The name of the queue. MUST be unique within an AWS account. |
fifoQueue | boolean | false | Specifies whether this is a FIFO (First-In-First-Out) queue. |
deduplicationScope | string | queue | For FIFO queues, specifies whether deduplication occurs at the queue or messageGroup level. |
fifoThroughputLimit | string | perQueue | For FIFO queues, specifies if the throughput limit applies perQueue or perMessageGroupId . |
deliveryDelay | integer | 0 | Seconds to delay a message before it can be received (0-900). |
visibilityTimeout | integer | 30 | Seconds a consumer locks a message before it's visible again (0-43200). |
receiveMessageWaitTime | integer | 0 | Enables long polling. The duration (0-20 seconds) that a receive call waits for a message to arrive. |
messageRetentionPeriod | integer | 345600 | Seconds to retain a message (60-1,209,600). |
redrivePolicy | object | - | An object defining the dead-letter queue (DLQ) settings. See Redrive Policy. |
policy | object | - | The queue's access policy. See Queue Policy. |
tags | object | - | Key-value pairs representing AWS tags for the queue. |
Redrive Policy
Defines the dead-letter queue (DLQ) where messages are sent after failing processing a certain number of times.
Property | Type | Default | Description |
---|---|---|---|
deadLetterQueue | object | - | Required. An object that identifies the DLQ by its arn or name . |
maxReceiveCount | integer | 10 | The number of times a message is received before being sent to the DLQ. |
Queue Policy
Defines the permissions for the SQS queue using a list of policy statements.
Property | Type | Description |
---|---|---|
statements | [object] | Required. An array of statement objects, each controlling a permission for the queue. |
Each statement object contains:
effect
:Allow
orDeny
.principal
: The AWS account or user the statement applies to.action
: The SQS permission being controlled (e.g.,sqs:SendMessage
).resource
: The ARN of the resource this policy applies to.condition
: (Optional) Conditions for the policy to take effect.
Examples
FIFO Queue with a Dead-Letter Queue
This example defines a FIFO queue named user-events.fifo
with a corresponding DLQ named user-events-dlq.fifo
. If a message fails to be processed after 5 attempts, it is moved to the DLQ.
channels:
userEvents:
bindings:
sqs:
queue:
name: user-events.fifo
fifoQueue: true
messageRetentionPeriod: 345600 # 4 days
redrivePolicy:
deadLetterQueue:
name: user-events-dlq # References the DLQ defined below
maxReceiveCount: 5
deadLetterQueue:
name: user-events-dlq.fifo
fifoQueue: true
bindingVersion: '0.3.0'
Queue with an Access Policy
This example defines a standard queue and attaches a policy that allows a specific IAM user to send messages to it.
channels:
orderProcessing:
bindings:
sqs:
queue:
name: order-processing-queue
fifoQueue: false
policy:
statements:
- effect: Allow
principal: 'arn:aws:iam::123456789012:user/order-service-user'
action: 'sqs:SendMessage'
bindingVersion: '0.3.0'
Changelog
Added
(queue | deadLetterQueue).policy
.statements
.resource
The resource(s) that this policy applies to.
{
"resource": {
"description": "The resource(s) that this policy applies to.",
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
(queue | deadLetterQueue).policy
.statements
.condition
Specific circumstances under which the policy grants permission
{
"condition": {
"description": "Specific circumstances under which the policy grants permission",
"type": "object",
"patternProperties": {
".*": {
"type": "object",
"patternProperties": {
".*": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
}
}
}
}
}
Changed
(queue | deadLetterQueue).policy
.statements
.principal
The AWS account(s) or resource ARN(s) that this statement applies to.
{
"principal": {
"description": "The AWS account(s) or resource ARN(s) that this statement applies to.",
"oneOf": [
{
"type": "string"
},
{
"type": "object",
"properties": {
"AWS": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"AWS"
],
"additionalProperties": false
},
{
"type": "object",
"properties": {
"Service": {
"oneOf": [
{
"type": "string"
},
{
"type": "array",
"items": {
"type": "string"
}
}
]
}
},
"required": [
"Service"
],
"additionalProperties": false
}
]
}
}