Skip to content

Instantly share code, notes, and snippets.

@philschmid
Created March 16, 2020 19:11
Show Gist options
  • Select an option

  • Save philschmid/e0a24eacd59c56bfc1e06e896d0e23fe to your computer and use it in GitHub Desktop.

Select an option

Save philschmid/e0a24eacd59c56bfc1e06e896d0e23fe to your computer and use it in GitHub Desktop.
var copy = require('copy-dynamodb-table').copy
var globalAWSConfig = { // AWS Configuration object http://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Config.html#constructor-property
accessKeyId: 'AKID',
secretAccessKey: 'SECRET',
region: 'eu-west-1'
}
var sourceAWSConfig = {
accessKeyId: 'AKID',
secretAccessKey: 'SECRET',
region: 'eu-west-1'
}
var destinationAWSConfig = {
accessKeyId: 'AKID',
secretAccessKey: 'SECRET',
region: 'us-west-2' // support cross zone copying
}
copy({
config: globalAWSConfig,
source: {
tableName: 'source_table_name', // required
config: sourceAWSConfig // optional , leave blank to use globalAWSConfig
},
destination: {
tableName: 'destination_table_name', // required
config: destinationAWSConfig // optional , leave blank to use globalAWSConfig
},
log: true,// default false
create : true // create destination table if not exist
},
function (err, result) {
if (err) {
console.log(err)
}
console.log(result)
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment