Coder Social home page Coder Social logo

aws-samples / aws-dynamodb-cross-region-replication Goto Github PK

View Code? Open in Web Editor NEW
16.0 22.0 3.0 1.2 MB

DynamoDB bi-directional replication solution between China regions and AWS commercial regions

License: MIT No Attribution

Python 98.41% Batchfile 1.59%
dynamodb global-tables china-region cdk

aws-dynamodb-cross-region-replication's Introduction

DynamoDB Bi-directional Replication Solution

Although DynamoDB service provides native global table feature for replication across region, there is no builtin solution for replication between AWS partitions, e.g. between AWS China regions and global (commercial) regions.

Feature

  • Active-active tables to sync up almost real-time
  • Serverless solution
  • Builtin failure management in handling transfer failure over Internet
  • Works for either transfer over Internet or private network
  • Replication status monitoring in Cloudwatch metrics
  • Provides load testing example
  • Deployment
    • Includes step-by-step manual setup guide
    • Automated deployment with CDK

Prerequisite

  • AWS global region account access (and IAM Access Key and Secret Key)
  • AWS China region account access (and IAM Access Key and Secret Key)

Architecture - How it works

image-20200424212120321

The solution is based on DynamoDB stream which captures all new/ update/delete to DynamoDB items. A Lambda function 'send_to_kinesis'

  • Consumes DynamoDB stream and send changes in batch using put_records to a staging Kinesis stream in target region over Internet
  • It will check “last_updater_region” in the item image and skip the changes that is already applied in the target table.

In order to stablize the network connectivity, the lambda will be placed in VPC and the Lambda traffic to Internet will go thru NAT Gateway in the VPC (with a fixed outbound IP address).

In the target region, the Lambda function 'replicator'

  • Consumes kinesis stream in target region and replicates the change to target table (CREATE/MODIFY/DELETE event together with old/new image of the DynamoDB item)
  • It only replicates the change to the target table if the target item’s timestamp is older than current one.

Manual Setup

See Setup Guide (Chinese version)

Automated Setup with AWS CDK (Cloud Development Kit)

See CDK set up guide

License

This library is licensed under the MIT-0 License. See the LICENSE file.

aws-dynamodb-cross-region-replication's People

Contributors

amazon-auto avatar lyulin-aws avatar yizhizoe avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Forkers

liangfb

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.