Skip to content

Compare SNS topic settings

Display name, signature version, tracing and encryption.

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
Topic configuration
~ orders DisplayName — DisplayName differs. (topics-staging: Orders, topics-prod: Orders (prod))
~ orders SignatureVersion — SignatureVersion differs. (topics-staging: 1, topics-prod: 2)
~ payments KmsMasterKeyId — KmsMasterKeyId is set on topics-staging and left to AWS on topics-prod. (topics-staging: alias/aws/sns, topics-prod: (not set))
Notes
- Topics-staging is account 300000001301 and topics-prod is account 300000001302; ARNs are compared by the name they end in.
Drift: 3 changed · 0 unmanaged · 0 missing (drift) — 4 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)
Topic configuration
~ orders DisplayName — DisplayName differs. (document: Orders, broker: Orders (prod))
~ orders SignatureVersion — SignatureVersion differs. (document: 1, broker: 2)
~ payments KmsMasterKeyId — KmsMasterKeyId is not set on the topic. (document: alias/aws/sns, broker: (not set))
Drift: 3 changed · 0 unmanaged · 0 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
Drift: 0 changed · 0 unmanaged · 0 missing (no drift) — 2 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
x-sns-attributes:
DisplayName: Orders
SignatureVersion: "1"
payments:
address: payments
bindings:
sns:
bindingVersion: 0.1.0
name: payments
ordering:
type: standard
x-sns-attributes:
KmsMasterKeyId: alias/aws/sns
operations: {}

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
x-sns-attributes:
DisplayName: Orders (prod)
SignatureVersion: "2"
payments:
address: payments
bindings:
sns:
bindingVersion: 0.1.0
name: payments
ordering:
type: standard
operations: {}

Download prod.yaml

How to build this setup yourself

topics-staging

Terminal window
awslocal sns create-topic --name orders --attributes '{"DisplayName": "Orders", "SignatureVersion": "1", "TracingConfig": "PassThrough"}'
awslocal sns create-topic --name payments --attributes '{"KmsMasterKeyId": "alias/aws/sns"}'

topics-prod

Terminal window
awslocal sns create-topic --name orders --attributes '{"DisplayName": "Orders (prod)", "SignatureVersion": "2", "TracingConfig": "Active"}'
awslocal sns create-topic --name payments

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