Skip to content

Compare SNS topics between staging and prod

Are prod’s topics and subscriptions the same as staging’s?

Terminal recording of kurkik sns diff

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

Terminal window
kurkik sns diff topics-staging topics-prod --consumers
topics-staging vs topics-prod
Amazon SNS topics-prod
Channels
+ shipments address — Topic shipments is not on topics-staging. (topics-prod: shipments)
Subscriptions
~ orders subscription.rawMessageDelivery — sqs:orders-queue: rawMessageDelivery differs. (topics-staging: true, topics-prod: false)
Notes
- Topics-staging is account 111111111111 and topics-prod is account 222222222222; ARNs are compared by the name they end in.
Drift: 1 changed · 1 unmanaged · 0 missing (drift) — 7 matched

Exit code 2: drift found, so a CI job can stop here.

Mark Means
~ both sides have it, but it differs
! only the first side has it
+ only the second side has it

A document and a connection (exit 2)

$ kurkik sns diff staging.yaml topics-prod --consumers
staging.yaml vs topics-prod
AsyncAPI 3.0.0 · Amazon SNS topics-prod (us-east-1)
Channels
+ shipments address — Topic shipments exists but no channel in the document describes it. (broker: shipments)
Subscriptions
! orders subscription — Subscription sqs:arn:aws:sqs:us-east-1:111111111111:orders-queue does not exist. (document: sqs:arn:aws:sqs:us-east-1:111111111111:orders-queue)
+ orders subscription — Subscription sqs:arn:aws:sqs:us-east-1:222222222222:orders-queue exists but is not declared by the document. (broker: sqs:arn:aws:sqs:us-east-1:222222222222:orders-queue)
! orders.fifo subscription — Subscription sqs:arn:aws:sqs:us-east-1:111111111111:orders-events.fifo does not exist. (document: sqs:arn:aws:sqs:us-east-1:111111111111:orders-events.fifo)
+ orders.fifo subscription — Subscription sqs:arn:aws:sqs:us-east-1:222222222222:orders-events.fifo exists but is not declared by the document. (broker: sqs:arn:aws:sqs:us-east-1:222222222222:orders-events.fifo)
Drift: 0 changed · 3 unmanaged · 2 missing (drift) — 3 matched

Two documents (exit 0)

$ kurkik sns diff staging.yaml prod.yaml --consumers
staging.yaml vs prod.yaml
AsyncAPI 3.0.0
Channels
+ shipments address — shipments is in prod.yaml and not in staging.yaml. (prod.yaml: shipments)
Drift: 0 changed · 1 unmanaged · 0 missing (no drift) — 4 matched

Download the JSON report (-o json)

staging.yaml
asyncapi: 3.0.0
info:
title: topics-staging Amazon SNS API
version: 1.0.0-SNAPSHOT
description: Generated by reading Amazon SNS of topics-staging (us-east-1).
servers:
sns:
host: localhost:14566
protocol: amazon-sns
description: Amazon SNS in us-east-1.
channels:
orders:
address: orders
bindings:
sns:
bindingVersion: 0.1.0
name: orders
ordering:
type: standard
orders.fifo:
address: orders.fifo
bindings:
sns:
bindingVersion: 0.1.0
name: orders.fifo
ordering:
type: FIFO
contentBasedDeduplication: true
x-sns-attributes:
KmsMasterKeyId: alias/aws/sns
operations:
receive_from_orders:
action: receive
channel:
$ref: "#/channels/orders"
description: Subscriptions of orders when this document was generated.
bindings:
sns:
bindingVersion: 0.1.0
consumers:
- protocol: sqs
endpoint:
arn: arn:aws:sqs:us-east-1:111111111111:orders-queue
filterPolicy:
status:
- paid
filterPolicyScope: MessageBody
rawMessageDelivery: true
redrivePolicy:
deadLetterTargetArn: arn:aws:sqs:us-east-1:111111111111:orders-dlq
receive_from_orders.fifo:
action: receive
channel:
$ref: "#/channels/orders.fifo"
description: Subscriptions of orders.fifo when this document was generated.
bindings:
sns:
bindingVersion: 0.1.0
consumers:
- protocol: sqs
endpoint:
arn: arn:aws:sqs:us-east-1:111111111111:orders-events.fifo
rawMessageDelivery: false

Download staging.yaml

prod.yaml
asyncapi: 3.0.0
info:
title: topics-prod Amazon SNS API
version: 1.0.0-SNAPSHOT
description: Generated by reading Amazon SNS of topics-prod (us-east-1).
servers:
sns:
host: localhost:14566
protocol: amazon-sns
description: Amazon SNS in us-east-1.
channels:
orders:
address: orders
bindings:
sns:
bindingVersion: 0.1.0
name: orders
ordering:
type: standard
orders.fifo:
address: orders.fifo
bindings:
sns:
bindingVersion: 0.1.0
name: orders.fifo
ordering:
type: FIFO
contentBasedDeduplication: true
x-sns-attributes:
KmsMasterKeyId: alias/aws/sns
shipments:
address: shipments
bindings:
sns:
bindingVersion: 0.1.0
name: shipments
ordering:
type: standard
operations:
receive_from_orders:
action: receive
channel:
$ref: "#/channels/orders"
description: Subscriptions of orders when this document was generated.
bindings:
sns:
bindingVersion: 0.1.0
consumers:
- protocol: sqs
endpoint:
arn: arn:aws:sqs:us-east-1:222222222222:orders-queue
filterPolicy:
status:
- paid
filterPolicyScope: MessageBody
rawMessageDelivery: false
redrivePolicy:
deadLetterTargetArn: arn:aws:sqs:us-east-1:222222222222:orders-dlq
receive_from_orders.fifo:
action: receive
channel:
$ref: "#/channels/orders.fifo"
description: Subscriptions of orders.fifo when this document was generated.
bindings:
sns:
bindingVersion: 0.1.0
consumers:
- protocol: sqs
endpoint:
arn: arn:aws:sqs:us-east-1:222222222222:orders-events.fifo
rawMessageDelivery: false

Download prod.yaml

All flags: kurkik sns diff · more Amazon SNS diff examples