diff --git a/pythoncode/ddb_sync_test2.py b/pythoncode/ddb_sync_test2.py new file mode 100644 index 0000000..0f77b38 --- /dev/null +++ b/pythoncode/ddb_sync_test2.py @@ -0,0 +1,18 @@ +import boto3 + +def syncTables(event, context): + source_ddb = boto3.client('dynamodb', 'us-east-1') + destination_ddb = boto3.client('dynamodb', 'us-west-2') + sync_ddb_table(source_ddb, destination_ddb) + +# Scan returns paginated results, so only partial data will be copied +def sync_ddb_table(source_ddb, destination_ddb): + response = source_ddb.scan( + TableName="table1" + ) + + for item in response['Items']: + destination_ddb.put_item( + TableName="table2", + Item=item + ) \ No newline at end of file