This is just a simple nodejs script to allow you make automatic backups in S3. We will use it to backup a mongoDb database.
- Nodejs
- AWS API Credentials
$ git clone: https://github.com/minorsolis/s3BackupNodeJS.git
$ cd s3BackupNodeJS
$ cd app/config/
$ cp -rp config.example.js config.js
aws_key: 'aws_key_here',
aws_secret: 'aws_secret_here',
aws_s3_bucket: 'aws_s3_bucket',
file_path: '/path_to_your_file/'
The folder includes a cron folder with a bit of bash code, just in case you need to extend this app.
open => cron/script.sh
It will show something like this
echo "Add the bash code here"
echo "..........................."
echo "cd /your_config_file_path/ && mongodump"
echo "tar -cvf dump.tar dump"
echo "..........................."
echo "Finally exec nodejs"
cd ../app/
node index.js
$ chmod 775 script.sh
0 1 * * * /{your_path}/cron/script.sh
$ crontab setCron.sh