Using Amazon Simple Notification Service (SNS) as an Open Data Stream Target, Part I

Problem:
You want to use open data stream to POST events up to Amazon Simple Notification Service (SNS). From SNS you and plug and play workflows and do really powerful things like hook Lambda functions, send various notifications, etc.

Here’s how to do it

In Amazon:

  1. Head to your console, then click on SNS:

image

  1. Create a topic. For now, just name it and create the topic - we’ll discuss the various options in a later post.

  1. Setup a subscriber. For this example, we’ll keep it simple and send an email, but note that you’ll see Lambda as a subscriber as well. More on this in a future post, but suffice it to say that being able to emit trigger and detection events into SNS and fan out to things like Lambda unlocks a bunch of capabilities for everyone running in AWS.

Click on “Create Subscription”, then pull select email and put in an address that you can use to validate your messages with. When you click submit, SNS will send a confirmation email with a link. Click that link to activate the subscription.

…My confirmation is below:


Now let’s setup our Open Data Stream target in Reveal(x):

  1. Head to Admin, then click on Open Data Streams:

  2. Click to create an HTTP ODS target. Here’s an example of the setup (I’ll put field-specific details below):


Details:

Host: sns.us-west-2.amazonaws.com (put your region in if it’s different).
Type: HTTPS
Port: 443
Additional HTTP Header: Content-Type: application/x-www-form-urlencoded
Authentication: Amazon Web Services
…followed by filling in your API information and your region. For me, it’s us-west-2.

For the test configuration:

Method: POST
Options: paste in the chunk below, replace

{
    "path": "/",
    "payload": "Action=Publish&TopicArn=<your-arn-here>&Version=2010-03-31&Subject=TESTING&Message=Test123",
    "headers": {}
}

Then click “test”, and you’ll see a 200 Ok response. Now head to your inbox, and voila:

That’s probably enough for now. I’ll do a part II on this next - how to call this from a trigger.