Amazon SNS Service Integration — Librato Blog

Amazon SNS Service Integration



Here at Librato, we're big fans and supporters of Open Source software. We frequently make our work public and contribute improvements back to projects that we adopt internally. So, it was a no-brainer to publish our service hooks as an Open Source module that could be studied and improved upon by both our internal engineers and external customers.

One of the big wins to come out of this is that our partners can quickly build their own service integrations for Librato. In fact, this is precisely how our Flowdock, Slack, and VictorOps services originated. And thanks to a recent contribution from one of our customers, I'm very pleased to announce the availability of a new service integration for Amazon SNS.

Amazon Simple Notification Service (SNS) makes it possible to coordinate and manage the delivery of messages to endpoints. SNS is frequently used to route notifications from your applications or services, through user-defined "topics", and eventually to one or more supported endpoints such as HTTP, Email, SMS, or even other supported Amazon Web Services. Librato supports SNS as a service notification type, allowing you to craft custom delivery pipelines for your Librato alert notifications. Alerts sent via the SNS service integration include a JSON payload that can be deconstructed and consumed programmatically.

AWS SNS Configuration

Before you start using the integration, you'll need to define a SNS Topic and Subscription. Adding a Topic will also generate an Amazon Resource Name (ARN) where messages can be published, and where the Subscription should read messages from.

From the SNS dashboard you'll want to choose Create New Topic to get started. Enter the Topic Name and Display Name, then click Create Topic to finish. From the Topic Details page, copy the Topic ARN value - we'll need that in the next step.

Next, visit the Subscriptions section and click on Create Subscription. Enter the Topic ARN that we copied from the previous step. Choose the delivery Protocol you wish to use, then the Endpoint value. Since we're creating an SMS subscription, we want to use a mobile phone number for this field. Click Subscribe to save the subscription.

The subscription we created will define how messages published to the ARN are routed along to their destination. However, we need to confirm the subscription Endpoint before any messages can be accepted. Note that the confirmation process differs according to the Protocol type chosen. Once you've confirmed your subscription you've finished with the SNS portion of the setup process.

One final AWS detail - we recommend creating a new AWS user with limited permissions. Go to the IAM Management Console and create a new user with publish permissions for the SNS Topic ARN you'll be using. Here is a sample policy document that covers our use case.

{
  "Statement": [
    {
      "Effect": "Allow",
      "Action": [
        "sns:Publish"
      ],
      "Resource": [
        "arn:aws:sns:us-east-1:1234567801234:TestTopic"
      ]
    }
  ]
}

Librato Service Configuration

Navigate to your Librato Account Settings. Click on the Services section from the menu on the left and then select the AWS SNS integration. Enter your Topic ARN, IAM Access Key, and IAM Secret Access Key in the appropriate fields, and click create service to save your new integration.

Alert Notification Service

After setting up the service you can associate alerts with your service destination. You can read more about creating alerts in the Introduction to Librato Alerts knowledge base article.

Are there other services you would like to see Librato Metrics integrated with? Fork our repo and contribute a service wrapper to librato-services.

Are you new to Librato? Start a full-featured 30-day trial for free. Sign up now.

Start using Librato now. Full-featured and free for 30 days. Pricing starts at $5 per month.
I accept the Terms of Service, Privacy Policy and occasional emails from Librato. Got questions? Talk to us.