Skip to content

Do SQS diffs compare access policies?

Short version: no. Here is how to check them.

Terminal recording of kurkik sqs diff

The recording shows kurkik sqs diff on the demo sandbox; its data differs from this example.

Terminal window
kurkik sqs diff queues-staging queues-prod
queues-staging vs queues-prod
Amazon SQS queues-prod
Notes
- Queues-staging is account 300000000601 and queues-prod is account 300000000602; ARNs are compared by the name they end in.
Drift: 0 changed · 0 unmanaged · 0 missing (no drift) — 7 matched

Exit code 0: no drift.

Mark Means
~ both sides have it, but it differs
! only the first side has it
+ only the second side has it
$ kurkik sqs scan queues-staging --acls
queues-staging - Amazon SQS, as arn:aws:iam::300000000601:root
queues (1)
orders-queue visibility 30s, retention 4d, sse
policy allow Service sns.amazonaws.com sqs:SendMessage
$ kurkik sqs scan queues-prod --acls
queues-prod - Amazon SQS, as arn:aws:iam::300000000602:root
queues (1)
orders-queue visibility 30s, retention 4d, sse
policy allow * sqs:SendMessage open to anyone

A document and a connection (exit 0)

$ kurkik sqs diff staging.yaml queues-prod
staging.yaml vs queues-prod
AsyncAPI 3.0.0 · Amazon SQS queues-prod (us-east-1)
Drift: 0 changed · 0 unmanaged · 0 missing (no drift) — 2 matched

Two documents (exit 0)

$ kurkik sqs diff staging.yaml prod.yaml
staging.yaml vs prod.yaml
AsyncAPI 3.0.0
Drift: 0 changed · 0 unmanaged · 0 missing (no drift) — 1 matched

Download the JSON report (-o json)

staging.yaml
asyncapi: 3.0.0
info:
title: queues-staging Amazon SQS API
version: 1.0.0-SNAPSHOT
description: Generated by reading Amazon SQS of queues-staging (us-east-1).
servers:
sqs:
host: localhost:14566
protocol: amazon-sqs
description: Amazon SQS in us-east-1.
channels:
orders-queue:
address: orders-queue
bindings:
sqs:
bindingVersion: 0.2.0
queue:
name: orders-queue
fifoQueue: false
deliveryDelay: 0
visibilityTimeout: 30
receiveMessageWaitTime: 0
messageRetentionPeriod: 345600
x-sqs-attributes:
MaximumMessageSize: 1048576
SqsManagedSseEnabled: true
operations: {}

Download staging.yaml

prod.yaml
asyncapi: 3.0.0
info:
title: queues-prod Amazon SQS API
version: 1.0.0-SNAPSHOT
description: Generated by reading Amazon SQS of queues-prod (us-east-1).
servers:
sqs:
host: localhost:14566
protocol: amazon-sqs
description: Amazon SQS in us-east-1.
channels:
orders-queue:
address: orders-queue
bindings:
sqs:
bindingVersion: 0.2.0
queue:
name: orders-queue
fifoQueue: false
deliveryDelay: 0
visibilityTimeout: 30
receiveMessageWaitTime: 0
messageRetentionPeriod: 345600
x-sqs-attributes:
MaximumMessageSize: 1048576
SqsManagedSseEnabled: true
operations: {}

Download prod.yaml

How to build this setup yourself

queues-staging

Terminal window
awslocal sqs create-queue --queue-name orders-queue
awslocal sqs set-queue-attributes --queue-url http://localhost:14566/300000000601/orders-queue --attributes '{"Policy": "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Sid\": \"send\", \"Effect\": \"Allow\", \"Principal\": {\"Service\": \"sns.amazonaws.com\"}, \"Action\": \"sqs:SendMessage\", \"Resource\": \"arn:aws:sqs:us-east-1:300000000601:orders-queue\"}]}"}'

queues-prod

Terminal window
awslocal sqs create-queue --queue-name orders-queue
awslocal sqs set-queue-attributes --queue-url http://localhost:14566/300000000602/orders-queue --attributes '{"Policy": "{\"Version\": \"2012-10-17\", \"Statement\": [{\"Sid\": \"send\", \"Effect\": \"Allow\", \"Principal\": \"*\", \"Action\": \"sqs:SendMessage\", \"Resource\": \"arn:aws:sqs:us-east-1:300000000602:orders-queue\"}]}"}'

All flags: kurkik sqs diff · more Amazon SQS diff examples