dynamodb-backup-restore
Advanced tools
Comparing version 0.1.1 to 0.1.2
'use strict'; | ||
const AWS = require('aws-sdk'); | ||
const config = require('./config'); | ||
@@ -5,0 +4,0 @@ const Backup = require('dynamodb-backup-restore').Backup; |
@@ -6,4 +6,4 @@ { | ||
"dependencies": { | ||
"dynamodb-backup-restore ": "0.1.1" | ||
"dynamodb-backup-restore ": "0.1.2" | ||
} | ||
} |
{ | ||
"name": "dynamodb-backup-restore", | ||
"version": "0.1.1", | ||
"description": "AWS DynamoDb tool for full, incremental backup and restore", | ||
"version": "0.1.2", | ||
"description": "NPM package for Backup and Restore AWS DynamoDB", | ||
"homepage": "https://github.com/Purple-Unicorns/DynamoDbBackUp", | ||
@@ -6,0 +6,0 @@ "main": "index.js", |
@@ -1,40 +0,70 @@ | ||
#dynamodb-backup-restore | ||
# dynamodb-backup-restore | ||
This is tool to back up DynamoDb table to S3 bucket and restore S3 objects to DynamoDb table. | ||
This tool supports following functionality: | ||
- Full backup AWS DynamoDb table to Amazon S3 bucket within or between regions. | ||
- Incremental backup AWS DynamoDb table to Amazon S3 bucket within or between regions. | ||
- AWS Lambda based incremental backup AWS DynamoDb tableto Amazon S3 bucket within or between regions. | ||
- Restore AWS DynamoDb table from Amazon S3 bucket within or between regions. | ||
- Deploy and configure Amazon S3 backup bucket. | ||
- Deploy, configure AWS Lambda and add event source. | ||
This tool looks like many other but has a great advantage - implemented with classes and ES6. | ||
Built on NodeJS calsses and ECMAScript 2015 (ES6). | ||
This tool requires to set all parameters except Restore Time. | ||
It can be used independently and as a dependency in your code. | ||
##Usage samples | ||
## Usage samples | ||
### Full backup | ||
```bash | ||
$ gulp backup-full --s3bucket <bucket> --s3prefix <prefix> --s3region <region> --dbtable <table> --dbregion <region> | ||
Options: | ||
--s3bucket (required) Amazon S3 backup bucket name | ||
--s3prefix (optional) subfolder for backup(recomend use AWS DynamoDb table name) | ||
--s3region (required) AWS Region for Amazon S3 backup bucket | ||
--dbtable (required) AWS DynamoDb table name | ||
--dbregion (required) AWS Region for AWS DynamoDb table | ||
``` | ||
$ gulp backup-full --s3bucket s3-bucket --s3prefix s3-prefix --s3region s3-region --dbtable db-name --dbregion db-region | ||
``` | ||
### Incremental backup | ||
```bash | ||
$ gulp backup-incremental --s3bucket <bucket> --s3prefix <prefix> --s3region <region> --dbtable <table> --dbregion <region> | ||
Options: | ||
--s3bucket (required) Amazon S3 backup bucket name | ||
--s3prefix (optional) subfolder for backup(recomend use AWS DynamoDb table name) | ||
--s3region (required) AWS Region for Amazon S3 backup bucket | ||
--dbtable (required) AWS DynamoDb table name | ||
--dbregion (required) AWS Region for AWS DynamoDb table | ||
``` | ||
$ gulp backup-incremental --s3bucket s3-bucket --s3prefix s3-prefix --s3region s3-region --dbtable db-name --dbregion db-region | ||
``` | ||
### AWS Lambda | ||
``` | ||
### AWS Lambda based incremental backup | ||
```javascript | ||
const Backup = require('dynamodb-backup-restore').Backup; | ||
module.exports.handler = (event, context, callback) => { | ||
let config = { | ||
S3Bucket: 'STRING_VALUE', /* required */ | ||
S3Region: 'STRING_VALUE', /* required */ | ||
S3Prefix: 'STRING_VALUE', /* required */ | ||
}; | ||
let backup = new Backup(config); | ||
return backup.fromDbStream(event.Records).then(() => { | ||
callback(); | ||
}).catch(err => { | ||
callback(err); | ||
}); | ||
if (!event.Records) { | ||
callback('There are no items to process.'); | ||
} | ||
else { | ||
let config = { | ||
S3Bucket: 'STRING_VALUE', /* required */ | ||
S3Region: 'STRING_VALUE', /* required */ | ||
S3Prefix: 'STRING_VALUE', /* optional */ | ||
}; | ||
let backup = new Backup(config); | ||
backup.fromDbStream(event.Records).then(() => { | ||
callback(); | ||
}).catch(err => { | ||
callback(err); | ||
}); | ||
} | ||
} | ||
``` | ||
### Restore | ||
```bash | ||
$ gulp restore --s3bucket <bucket> --s3prefix <prefix> --s3region <region> --dbtable <table> --dbregion <region> | ||
Options: | ||
--s3bucket (required) Amazon S3 backup bucket name | ||
--s3prefix (optional) subfolder for backup(recomend use AWS DynamoDb table name) | ||
--s3region (required) AWS Region for Amazon S3 backup bucket | ||
--dbtable (required) AWS DynamoDb table name | ||
--dbregion (required) AWS Region for AWS DynamoDb table | ||
``` | ||
$ gulp restore --s3bucket s3-bucket --s3prefix s3-prefix --s3region s3-region --dbtable db-name --dbregion db-region | ||
``` | ||
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
60513
71
1512