Skip to content

Export SNS subscriptions to AsyncAPI

Add --consumers to write down the subscriptions too.

Terminal recording of kurkik sns export

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

Terminal window
kurkik sns export topics-prod --consumers --stdout
asyncapi.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
payments:
address: payments
bindings:
sns:
bindingVersion: 0.1.0
name: payments
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:400000001101:orders-queue
rawMessageDelivery: true

Download asyncapi.yaml

How to build this setup yourself

topics-prod

Terminal window
awslocal sqs create-queue --queue-name orders-queue
awslocal sqs create-queue --queue-name orders-dlq
awslocal sns create-topic --name orders
awslocal sns subscribe --topic-arn arn:aws:sns:us-east-1:400000001101:orders --protocol sqs --notification-endpoint arn:aws:sqs:us-east-1:400000001101:orders-queue --return-subscription-arn
awslocal sns set-subscription-attributes --subscription-arn arn:aws:sns:us-east-1:400000001101:orders:ba716bb8-4359-4b53-8cc2-be6107878020 --attribute-name RawMessageDelivery --attribute-value true
awslocal sns create-topic --name payments

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