GithubHelp home page GithubHelp logo

krishnan-mani / stdream-reader Goto Github PK

View Code? Open in Web Editor NEW
0.0 2.0 0.0 12 KB

Respond to item changes in a DynamoDB table by subscribing a Lambda function to DynamoDB Streams

License: The Unlicense

Ruby 53.17% JavaScript 46.83%
dynamodb dynamodb-stream aws-lambda sam-template cloudwatch-events

stdream-reader's Introduction

Respond to item changes in a DynamoDB table by subscribing a Lambda function to DynamoDB Streams

Contents

  • Provisions a stack named "st(d)ream-reader" for the workload consisting of a DynamoDB table with streams enabled, and a Lambda function subscribed to the stream
  • Another stack "test-function" provisions a test fixture with Scheduled CloudWatch Event Rules that invoke a Lambda function at intervals to put new items in the table
  • Also includes a Rake task to put multiple items into the table

HOW-TO

# Assuming "my-artifacts-bucket" is the S3 bucket used when packaging and deploying the SAM transform

stdream-reader $ sam package --s3-bucket my-artifacts-bucket --template-file template.yaml --output-file output-template.yaml
stdream-reader $ sam deploy --template-file output-template.yaml --stack-name stdream-reader-test --capabilities CAPABILITY_IAM 

  • Test putting some items in the table
# Get table name

stdream-reader $ aws cloudformation describe-stacks --stack-name stdream-reader-test --query "Stacks[0].Outputs[0].OutputValue" --output text

# Use the rake task to put items

stdream-reader $ rake -D put_item
rake put_item[table,region,item_count]
    Put multiple items in DynamoDB table (upto a maximum of 25) using batch_write_item

# Assuming table name is "my-table" in region "us-east-1", run rake task as follows
stdream-reader $ rake put_item["my-table", "us-east-1", 20]

stdream-reader $ cd test-function
test-function $ sam package --s3-bucket my-artifacts-bucket --template-file template.yaml --output-file output-template.yaml
test-function $ sam deploy --template-file output-template.yaml --stack-name write-function-test --parameter-overrides StackName=stdream-reader-test --capabilities CAPABILITY_IAM 

TODO

  • Illustrate responding to different kinds of changes
  • Implement TTL and process deleted items
  • Provision a CloudWatch dashboard for monitoring
  • Elaborate on batch size, iterator age and other aspects of stream processing

stdream-reader's People

Contributors

krishnan-mani avatar

Watchers

 avatar  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.