Queue

An encrypted SQS queue with a dead-letter queue always provisioned, so failed messages are kept, not dropped. Wire a Lambda consumer in one step.

Messaging · anvil:aws:Queue

Arguments

Names below are TypeScript (camelCase). In Python use snake_case (e.g. dataClassification → data_classification); in Go use PascalCase on the Args struct (e.g. DataClassification).

fifo
boolean

Creates a FIFO queue when true. FIFO queues guarantee message ordering and exactly-once processing but have lower throughput (~3,000 msg/s vs unlimited for standard). Use for financial transactions, inventory updates, or any workflow where ordering or deduplication matters. Default: false.

dlq
object (QueueDlqArgs)

Dead letter queue configuration. Always provisioned. Omit to use defaults (managed DLQ, maxReceiveCount: 3). Set arn to reuse an existing queue.

consumer
object (QueueConsumerArgs)

Wires a compute resource to consume messages from this queue. Creates the event source mapping (trigger) and grants the necessary IAM permissions automatically.

consumer 1 field

Consumer configuration for this queue.

lambda
object (QueueLambdaConsumerArgs)

Wire an Anvil Lambda function as the SQS consumer. Creates the event source mapping and grants sqs:ReceiveMessage, sqs:DeleteMessage, sqs:GetQueueAttributes to the Lambda's execution role.

consumer.lambda 2 fields

Lambda consumer configuration. Pass fn.arn and fn.roleArn from an Anvil Lambda component.

arn required
string

The ARN of the Lambda function to trigger. Use fn.arn from an Anvil Lambda component.

lambdaRoleArn required
string

The ARN of the Lambda's execution role. Use fn.roleArn from an Anvil Lambda component. Required for Anvil to attach the consume permissions policy.

dlq 2 fields

Dead letter queue configuration. Set arn to reuse an existing queue. Omit arn to create a managed DLQ.

arn
string

ARN of an existing queue to use as the DLQ. If the parent queue is fifo: true, this ARN must end with ".fifo". When omitted, Anvil creates a managed DLQ.

maxReceiveCount
integer

How many times a message can be received before being moved to the DLQ. Default: 3.

This component also accepts a hatch argument to override the underlying resource configuration. See Overrides & Escape Hatch.

Attributes

Outputs available once the resource is deployed.

url
string

The URL of the SQS queue. Use this to send and receive messages.

arn
string

The ARN of the SQS queue.

name
string

The physical name of the SQS queue.

dlqUrl
string

The URL of the dead letter queue.

dlqArn
string

The ARN of the dead letter queue.