Created
March 26, 2020 00:13
-
-
Save michiel/52670434b48466aef225bfd2a208d12e to your computer and use it in GitHub Desktop.
Revisions
-
michiel created this gist
Mar 26, 2020 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,21 @@ #!/bin/sh SOURCE_TABLE=xxx-mydata-accp TARGET_TABLE=xxx-mydata-prod AWS_PROFILE=default AWS_REGION=ap-southeast-2 # Step 1 - export and transform aws --profile=$AWS_PROFILE \ --region=$AWS_REGION \ dynamodb scan \ --table-name $SOURCE_TABLE \ | jq '{"$TARGET_TABLE": [.Items[] | {PutRequest: {Item: .}}]}' > export.json # Step 2 - import data aws --profile=$AWS_PROFILE \ --region=$AWS_REGION \ dynamodb batch-write-item \ --request-items export.json