title: How to listen to SNS messages from the CLI to test they have been sent?
body: <p>I'm looking for a way to listen arbitrarily to my SNS Topic, and in parallel trigger a SNS message from my code base. Next I need to test if that message was sent correctly.</p>
  
  <pre><code>code-that-listens-and-exits-when-it-gets-hello-world-message
  aws sns publish --topic-arn arn:aws:sns:ap-southeast-1:123456789:hello --message "Hello World!"
  </code></pre>
  
  <p>I find plenty of information how to <a href="https://docs.aws.amazon.com/cli/latest/userguide/cli-sqs-queue-sns-topic.html" rel="nofollow noreferrer">subscribe to a topic</a> from the CLI, but I am puzzled how to actually listen or test for the event coming through the topic. Which <strong><a href="https://docs.aws.amazon.com/sns/latest/dg/welcome.html" rel="nofollow noreferrer">protocol</a></strong> should I be using? I don't want to go down the route of checking a subscribed email endpoint contains the message in the inbox.</p>