mousavian / dr-dynamo

DynamoDB Disaster Recovery - A tool to backup DynamoDB tables to S3 and restore
MIT License
4 stars 3 forks source link

Refactoring restore #3

Closed mousavian closed 7 years ago

mousavian commented 7 years ago

usage example: suppose backup & its schema exists on path below:

s3://my-bucket/backup-2017-09-06/my-table.schema.json
s3://my-bucket/backup-2017-09-06/my-table.json

so:

  const restore = new DynamoRestore({
    aws: {
        region: '',
        accessKeyId '',
        secretAccessKey '',
    },
    bucket: 'my-archive',
    restorePath: 'backup-2017-09-06',
    table: 'my-table',
    overwrite: true
  })

  restore.on('error', console.error)
  restore.on('warning', console.warn)
  restore.on('info', console.info)
  restore.on('progress', console.log)

  restore.on('finish', function() {
    console.log('Finished restoring DynamoDB table')
  })

  restore.on('start', function() {
    console.log('restoring started')
  })

  restore.run()