Giter VIP home page Giter VIP logo

elasticcloud-dynamodb-stream's Introduction

js-standard-style

    Basically a fork of https://github.com/matrus2/dynamodb-stream-elasticsearch                  

Works only with the standard Elasticsearch >= 7.2

DynamoDB --> Stream --> ElasticSearch

The missing blueprint for AWS Lambda, which reads stream from AWS DynamoDB and writes it to ElasticSearch. Compatible with node 10.x.

Whenever data is changed (modified, removed or inserted) in DynamoDB one can use AWS Lambda function to capture this change and update ElasticSearch machine immediately. Further reading:

Getting Started

Install:

npm install --save elasticcloud-dynamodb-stream 

Use it in your lambda:

const {pushStream} = require("elasticcloud-dynamodb-stream")

const trans = async (obj) => {
    // do stuff with obj
    return obj
}

const ES_ARGS = {
  index: process.env.INDEX, 
  host: process.env.ES_ENDPOINT,
  transformFunction: trans, // OPTIONAL
  refresh: false
}

module.exports.toElastic = async (event, context) => {
    try {
      await pushStream({ event,  ...ES_ARGS})
    } catch(e) {
      console.log(e)
      throw e
    }
    return  `Successfully processed ${event.Records.length} records.`
}

Parameters

Param Description Required
event Event object generated by the stream (pass it as it is and don't modify) required
endpoint Exact url of ElasticSearch instance (it works only with standard ES) (string) required
index The name of ElasticSearch index (string). If not provided will set the same as DynamoDB table name optional
refresh Force ElasticSearch refresh its index immediately more here (boolean). Default: true optional
transformFunction A function/promise to transform each record before sending them to ES. Applies to INSERT and UPDATE operations optional
options Additional set of arguments passed to elasticsearch Client see here optional

Authors & Contributors

License

This project is licensed under the MIT License - see the LICENSE.md file for details

elasticcloud-dynamodb-stream's People

Contributors

cgeduhn avatar

Watchers

 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.