Edit on github

#SNS

In the following example we create a new SNS topic with the name dispatch which is bound to the dispatcher function. The function will be called every time a message is sent to the dispatch topic.

functions:
  dispatcher:
    handler: dispatcher.dispatch
    events:
      - sns: dispatch

You're also able to add the same SNS topic to multiple functions:

functions:
  dispatcher:
    handler: dispatcher.dispatch
    events:
      - sns: dispatch
  dispatcher2:
    handler: dispatcher2.dispatch
    events:
      - sns: dispatch

This will run both functions for a message sent to the dispatch topic.

#Using a pre-existing topic

If an arn: is specified, the framework will give permission to the topic to invoke the function and subscribe the function to the topic.

functions:
  dispatcher:
    handler: dispatcher.dispatch
    events:
      - sns: arn:xxx

#Setting a display name

This event definition ensures that the aggregator function gets called every time a message is sent to the aggregate topic. Data aggregation pipeline will be shown in the AWS console so that the user can understand what the SNS topic is used for.

functions:
  aggregator:
    handler: aggregator.handler
    events:
      - sns:
          topicName: aggregate
          displayName: Data aggregation pipeline