Skip to content

AWS SAM/Lambda application that posts SNS messages to external services

License

Notifications You must be signed in to change notification settings

eladkehat/lipwig

Repository files navigation

Lipwig - Post SNS messages to external services

Lipwig is an AWS SAM/Lambda application that posts SNS messages to external services, like Slack.

Use Case

Publishing a message to an SNS topics is a common way to notify subscribers of some event in your system. For example, a dead letter queue topic lets publish events that your lambda function failed to handle.

But what if you want a person or team of people to know of the message? Out of the box, SNS only supports email (slow), push messages to an app that you own, or SMS (not free).

Lipwig provides lambda functions that you can subscribe to an SNS topic in order to publish its events to additional services that you use.

How to Use

  1. Deploy the Lipwig app in your environment. You can use:
S3_BUCKET=your_deploy_bucket make publish
  1. Either subscribe Lipwig lambda functions directly to SNS topics via the AWS console or CLI, or use Fn::ImportValue to add the subscription in your own CloudFormation template (see this walkthrough for an example).

Services

CloudWatch Logs

Log SNS messages to CloudWatch Logs.

No additional configuration is needed for this function. Look for its log stream in CloudWatch to see the messages.

The CloudWatch function is exported as lipwig-CloudWatchLogsFunction.

Slack

Post SNS messages to Slack.

  1. Create a Slack app.
  2. Give your app the chat:write:bot permission scope.
  3. Make the app's OAuth access token available to Lipwig:
    • Either add it to the lambda function's environment variables, as an encrypted variable, with the key SLACK_TOKEN.
    • Or add it to SSM ParameterStore, as an encrypted parameter, with the key /Lipwig/SlackToken.
  4. You can control the channel that messages are posted to by adding an environment variable with the key SLACK_CHANNEL. If you do not specify a channel, then #lipwig is used by default.

The Slack function is exported as lipwig-SlackFunction.

Why "Lipwig"?

The name is a reference to Moist von Lipwig, the Ankh-Morpork Postmaster General in Terry Pratchett's novel Going Postal.

Lipwig can post message anywhere, just like the revitalized Ankh-Morpork postal service under von Lipwig.

Moist von Lipwig

About

AWS SAM/Lambda application that posts SNS messages to external services

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published