Giter VIP home page Giter VIP logo

cross-account-amazon-dynamodb-replication's Introduction

Cross Account Amazon DynamoDB Replication

This repository accompanies the Cross Account Amazon DynamoDB Replication blog post. It contains two AWS Serverless Application Model (AWS SAM) templates.

  1. First template deploys an AWS Glue job used for loading the data from the source DynamoDB table to the target DynamoDB table. If you are using the native DynamoDB export feature, do not use this template. Only use this template if the source DynamoDB table size is less than 140GB and you are using AWS Glue job for export and import.
  2. The second template deploys one AWS Lambda function that reads from source DynamoDB stream and replicates the changes to the target Amazon DyanmoDB table in a different AWS account.
├── README.MD <-- This instructions file

├── InitialLoad <-- The SAM template for Initial Load using Glue for import and export

├── ChangeDataCapture <-- The SAM template for Change Data Capture (CDC)

├── InitialMigrationWithNativeExport <-- Sample Glue code to help you get started. Bash script to change the owner of the objects in the target S3 bucket.

General Requirements

  • AWS CLI already configured with Administrator permission
  • Install SAM CLI if you do not have it.
  • Source and target tables created in DynamoDB
  • Target IAM role created with permissions to write to target DynamoDB table
  • For Change Data Capture, DynamoDB streams should be enabled on source table

Installation Instructions

Clone the repo onto your local development machine using git clone <repo url>.

Initial Load

  1. From the command line, change directory to SAM template directory for Initial Load

cd InitialLoad

  1. Run the below commands to deploy the template

sam build

sam deploy --guided

Follow the prompts in the deploy process to set the stack name, AWS Region and other parameters.

Initial Load Parameter Details

  • TargetDynamoDBTable: Target DynamoDB Table name
  • TargetAccountNumber: Target AWS Account Number
  • TargetRoleName: Target IAM Role name to be assumed by the Glue job
  • TargetRegion: The region for the target DynamoDB table
  • SourceDynamoDBTable: Source DynamoDB Table name
  • WorkerType: The type of predefined worker that is allocated when a job runs. Accepts a value of Standard, G.1X, or G.2X.
  • NumberOfWorkers: The number of workers of a defined workerType that are allocated when a job runs.
  • JobName: Name of the Glue Job

Change Data Capture (CDC)

  1. From the command line, change directory to SAM template directory for Initial Load

cd ChangeDataCapture

  1. Run the below commands to deploy the template

sam build

sam deploy --guided

Follow the prompts in the deploy process to set the stack name, AWS Region and other parameters.

CDC Parameter Details

  • TargetDynamoDBTable: Target DynamoDB Table name
  • TargetAccountNumber: Target AWS Account Number
  • TargetRoleName: Target IAM Role name to be assumed by Lambda function
  • TargetRegion: The region for the target DynamoDB table
  • MaximumRecordAgeInSeconds: The maximum age (in seconds) of a record in the stream that Lambda sends to your function.
  • SourceTableStreamARN: Source DynamoDB table stream ARN

Security

See CONTRIBUTING for more information.

License

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

cross-account-amazon-dynamodb-replication's People

Contributors

ahmedszamzam avatar amazon-auto 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.