Skip to main content

Listen to and inspect AWS SNS topic data

Project description


Listen to and inspect AWS SNS topic data!

Because SNS data is ephemeral, we need to make a place to receive and store the data if we want to inspect it. While you can subscribe your email address, it’s not very handy to do so (SMS is obviously not better). A clean (if slightly over-complex) method for doing this is to create a temporary SQS queue, then subscribe the queue to the SNS topic you want to inspect, and then watch that queue.

Snifter does all that in a single command. The queue is build and torn down for you, and it will endlessly listen to that queue, including dropping into an interactive debug session that will let you inspect the payload in detail.

Provide a profile and a topic, the queue will be torn down when it catches Ctrl+c

Basic Usage

$ snifter --profile=dev-power --topic=tim-manager-events
Deleted queue with URL

Debug Usage

Providing the –debug flag will cause you to drop into a debugger when something is popped from the queue, PDB behavior applies. The payload of the SNS message (‘Message’) is assigned a namespace (‘m’). This means that you get tab completion on the dynamic keys in your message payload.


$ snifter --help
usage: snifter [-h] [-p PROFILE] [-d] [-t TOPIC]

Listen to an SNS topic

optional arguments:
  -h, --help            show this help message and exit
  -p PROFILE, --profile PROFILE
                        AWS profile name
  -d, --debug           Drop into debugger to inspect message
  -t TOPIC, --topic TOPIC
                        SNS topic name



Inspecting (with debug on)

$ snifter --profile=dev-power --topic=tim-manager-events --debug
Attempting decode of body
Dropping into debugger for inspection
Local message namespace is 'm'
PDB commands: 'c' to continue, 'exit()' to exit
[2] > /home/ahonnecke/src/snifter/src/snifter/
-> message.delete()
(Pdb++) list
156                         print("PDB commands: 'c' to continue, 'exit()' to exit")
157                         breakpoint()
158                     else:
159                         print(f"Recieved message, {show}")
161  ->                 message.delete()
163                 print("Listening...")
164                 sleep(1)
(Pdb++) print(m.curve_angle)
(Pdb++) print(m.failed_rsu_ids)
['590d0953-444d-4f0a-842d-3ad425394baf', '8bfacac8-9c8f-41e6-b9a3-09641913da8a', 'd4d7cc04-b98a-4ad8-b9b6-801966c84f68', 'e7e259da-926c-4c0e-93cd-a8507bda76b3']

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

snifter-0.0.19.tar.gz (22.6 kB view hashes)

Uploaded Source

Built Distribution

snifter-0.0.19-py3-none-any.whl (6.9 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page