Last active
July 20, 2020 00:33
-
-
Save aichholzer/8e69db74ccf03e4964246f7169d7424f to your computer and use it in GitHub Desktop.
Revisions
-
aichholzer revised this gist
Jul 20, 2020 . 1 changed file with 2 additions and 0 deletions.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 @@ -1,3 +1,5 @@ #!/usr/bin/env node /* eslint no-console: 0 */ const AWS = require('aws-sdk'); AWS.config.update({ region: 'ap-southeast-2' }); -
aichholzer created this gist
Jul 20, 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,16 @@ /* eslint no-console: 0 */ const AWS = require('aws-sdk'); AWS.config.update({ region: 'ap-southeast-2' }); const db = new AWS.DynamoDB.DocumentClient(); const [, , from, to] = [...process.argv]; if (!from || !to) { console.error('\n 💥 The "from" and "to" arguments are required.'); process.exit(1); } db.scan({ TableName: from }) .promise() .then((data) => Promise.all(data.Items.map((Item) => db.put({ TableName: to, Item }).promise()))) .then(() => console.log('\n ✔ Done')) .catch((error) => console.log(`\n 💥 ${error.message}`));