Netflix-Skunkworks/swag-functions

Name: swag-functions

Owner: Netflix-Skunkworks

Description: Lambda functions for SWAG management

Created: 2017-08-01 17:30:45.0

Updated: 2018-03-27 23:56:11.0

Pushed: 2018-03-27 23:56:10.0

Homepage: null

Size: 6

Language: Python

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

?? Lambda Functions for SWAG

serverless

About

These are a collection of serverless functions that are useful when used in conjunction with SWAG.

s3-forwarder

This function is triggered off of a Dynamodb stream, processing insert and delete events, then using the swag-client ensures that these changes are propagated the specified S3 bucket.

This is useful for cases where you want SWAG data to be located in Dynamodb but also offer up a flat json file for consumption by the swag-client or other clients.

IAM Permissions

In order to use the s3-forwarder Lambda ensure that you create a role with the following permissions:

S3

"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Stmt1501177608000",
        "Effect": "Allow",
        "Action": [
            "s3:GetObject",
            "s3:ListBucket",
            "s3:PutObject"
        ],
        "Resource": [
            "<you-bucket-arn>"
        ]
    }
]

Dynamodb

"Version": "2012-10-17",
"Statement": [
    {
        "Sid": "Stmt1501174124000",
        "Effect": "Allow",
        "Action": [
            "dynamodb:DescribeStream",
            "dynamodb:GetRecords",
            "dynamodb:GetShardIterator",
            "dynamodb:ListStreams"
        ],
        "Resource": [
            "<your-stream-arn>"
        ]
    }
]

Dynamodb

This serverless function will add Dynamodb stream trigger to our the s3-forwarder but will not create the stream for us, ensure that NewItem is sent to the function through the Dynamodb stream.

Monitoring

All of the functions are wrapped with the RavenLambdaWrapper. This decorator forwards lambda telemetry to a Sentry instance. This will have no effect unless you specify SENTRY_DSN in the Lambda's environment variables.


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.