Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

AWS SQS / SNS

Consumes from an SQS queue or publishes to an SQS queue / SNS topic. Credentials come from the standard AWS provider chain (environment, profile, instance role) unless supplied explicitly as query params.

URL format

aws://?queue_url=<sqs-url>&region=<region>

aws:// and aws-sqs:// are both accepted. The host is unused — the queue is selected by queue_url (required for consumers, and for publishers unless topic_arn is set for SNS). Point endpoint_url at LocalStack for local testing.

Examples

Drain an SQS queue into a file, one-shot:

mq-bridge-app copy --drain \
  --from 'aws://?queue_url=https://sqs.us-east-1.amazonaws.com/1234/orders&region=us-east-1' \
  --to file:///data/orders.jsonl?format=json

Publish a Postgres table to an SNS topic, one-shot:

mq-bridge-app copy --drain \
  --from postgres://user:pass@localhost/app?table=orders \
  --to 'aws://?topic_arn=arn:aws:sns:us-east-1:1234:orders&region=us-east-1'

LocalStack, continuous:

mq-bridge-app copy \
  --from 'aws://?queue_url=http://localhost:4566/000000000000/orders&region=us-east-1&endpoint_url=http://localhost:4566&access_key=test&secret_key=test' \
  --to null:

Warning

access_key / secret_key in the URL are shown here only because LocalStack’s test/test are throwaway values. Never put real credentials in a connector URL — they leak into shell history and process listings. Against real AWS, omit both and let the standard provider chain (env vars, ~/.aws/credentials, IAM role) supply them; see Secrets.

Key options

OptionPurpose
queue_urlSQS queue URL. Required for consumers; optional for publishers if topic_arn is set.
topic_arnPublisher-only: SNS topic ARN to publish to.
regionAWS region (e.g. us-east-1).
endpoint_urlCustom endpoint (e.g. LocalStack).
access_key / secret_key / session_tokenExplicit credentials (otherwise the AWS provider chain is used).
max_messagesConsumer-only: batch size per receive (1–10).
wait_time_secondsConsumer-only: long-poll wait (0–20).

Full field list: reference/aws.md.