Giter Site home page Giter Site logo

le-aws-sns's Introduction

le-aws-sns

AWS Lambda function for sending AWS SNS messages to Logentries in near real-time for processing and analysing

When a message is published to an SNS topic that has a Lambda function subscribed to it, the Lambda function is invoked with the payload of the published message. That message gets forwarded to Logentries by this script, using token TCP.

Obtain log token(s)

  1. Log in to your Logentries account
  2. Add a new token based log
    • Optional: repeat to add second log for debugging

Deploy the script on AWS Lambda

  1. Create a new Lambda function

    Create Function

  2. On the "Select Blueprint" screen, press "Skip"

    Choose Blueprint

  3. Configure function:

    • Give your function a name
    • Set runtime to Python 2.7

    Create Function

  4. Edit code:

    • Edit the contents of le_config.py
    • Replace values of log_token and debug_token with tokens obtained earlier.
    • Create a .ZIP file, containing the updated le_config.py, le_sns.py and le_certs.pem
      • Make sure the files are in the root of the ZIP archive, and NOT in a folder
    • Choose "Upload a .ZIP file" in AWS Lambda and upload the archive created in previous step

    Create Function

  5. Lambda function handler and role

    • Change the "Handler" value to le_sns.lambda_handler
    • Create a new basic execution role (your IAM user must have sufficient permissions to create & assign new roles)

    Create Function

  6. Allocate resources:

    • Set memory to 128 MB
    • Set timeout to ~1 minute (script only runs for seconds at a time)

Create Function

  1. Enable function:

    • Click "Create function"

    Create Function

Configuring Amazon SNS with Lambda Endpoints with the AWS Management Console

  1. Sign in to the AWS Management Console and open the Amazon SNS console at https://console.aws.amazon.com/sns/.

  2. In the left Navigation pane, click Topics, and then click the topic to which you want to subscribe a Lambda endpoint.

  3. Click Actions and then click Subscribe to topic.

  4. In the Protocol drop-down box, select AWS Lambda.

  5. In the Endpoint drop-down box, select the ARN for the Lambda function.

  6. In the Version or Alias drop-down box, select an available version or alias to use. You can also choose $LATEST to specify the latest version of the Lambda function. If you do not want to specify a version or alias, you can also choose default, which is functionally the same as $LATEST.

  7. Click Create subscription.

  8. Watch your logs come in:

le-aws-sns's People

Contributors

omgapuppy avatar stephenhynes7 avatar

Watchers

James Cloos avatar Laxman Singh avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.