Replicating Amazon DynamoDB tables in different regions

Often developers who work on AWS DynamoDB happen to replicate one or more tables on a different region. This can be done using AWS S3 and AWS Data Pipeline as explained here.

But for those hardcore command-line fans who don’t like to do click, click, click (same as me). The following is a simple python script which uses boto3, that will replicate the required table in a different region with the same key schema, attribute definitions and copy data into it.

How the script works:

  • Scan the existing table for schema, attributes and data.
https://gist.github.com/Dineshkarthik/d0944c45b06726a327a9536a33dabdd2
python dynamodb_replicate_table.py -t my-table -r eu-west-1 -nr us-east-2

The above will replicate the table named “my-table” in eu-west-1 to us-east-2.

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data…

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com

Dineshkarthik Raveendran

Written by

Pythonista | Data Engineer | Open Source Enthusiast | Know more @ https://dineshkarthik.me

Analytics Vidhya

Analytics Vidhya is a community of Analytics and Data Science professionals. We are building the next-gen data science ecosystem https://www.analyticsvidhya.com