Skip to content

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.

PropertyTypeDefaultDescription
namestring-The name of the queue. MUST be unique within an AWS account.
fifoQueuebooleanfalseSpecifies whether this is a FIFO (First-In-First-Out) queue.
deduplicationScopestringqueueFor FIFO queues, specifies whether deduplication occurs at the queue or messageGroup level.
fifoThroughputLimitstringperQueueFor FIFO queues, specifies if the throughput limit applies perQueue or perMessageGroupId.
deliveryDelayinteger0Seconds to delay a message before it can be received (0-900).
visibilityTimeoutinteger30Seconds a consumer locks a message before it's visible again (0-43200).
receiveMessageWaitTimeinteger0Enables long polling. The duration (0-20 seconds) that a receive call waits for a message to arrive.
messageRetentionPeriodinteger345600Seconds to retain a message (60-1,209,600).
redrivePolicyobject-An object defining the dead-letter queue (DLQ) settings. See Redrive Policy.
policyobject-The queue's access policy. See Queue Policy.
tagsobject-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.

PropertyTypeDefaultDescription
deadLetterQueueobject-Required. An object that identifies the DLQ by its arn or name.
maxReceiveCountinteger10The 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.

PropertyTypeDescription
statements[object]Required. An array of statement objects, each controlling a permission for the queue.

Each statement object contains:

  • effect: Allow or Deny.
  • 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.

yaml
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.

yaml
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.

json
{ 
  "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

json
{
  "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.

json
{
  "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 
      }
    ]
  }
}