- This system will backup folders and upload them to your s3 bucket
- Every backup is encrypted using the ZIP encryption algorithm
- Backups can automatically done every hour
- Backups can automatically be deleted from your S3-Bucket every x days
Probably not tbh. It's quite complicated to set up, and the project only hase a very small and specific use-case.
Why is it called "Simple.." if it's complicated to set up? ~ I am very glad you asked, it's because the code is quite simple and it took not a very long time to develop this "thing".
Make sure you have zip
installed on your system: apt install zip
.
- Clone this repo:
git clone https://github.com/SCDerox/simple-directory-to-s3-backup.git
- Install dependencies
npm ci
- Set up a S3-Bucket on AWS
- Create a configuration-file called
config.json
in the cloned directory and change the configured parameters ( explained below). - Then start the script as described below.
- If you only want to back up once run
npm start
in the cloned directory - To ensure that backups are performed hourly, I suggest to use pm2:
pm2 start index.js
You can change these parameters in the config.json
you created earlier.
key
: Password with which the ZIP should be encryptedprefix
: Optional prefix which should be put before every filennamepath
: Path on your S3-Bucket in which the backup should be savedenabledHourlyUpload
: If enabled the script will backup your files hourlylimitHoursTo
: Array of strings; Hours to limit the hourly upload tofolders
: Array of the following paths that should get backed uprunCommandsBeforeExecution
: Array of commands to run before execution (for examplemysqldump
or something)bucketID
: ID of your S3-BucketaccessKeyID
: ID of your access-keybucketRegion
: Region of your bucketsecretAccessKey
: Secret of your access-keydeleteItems
: If enabled, S3 objects will be deleted automatically (in the specified folder) if they are older thandaysBeforeDeletion
. We suggest using lifecycle rules is supported by your S3 provider.doNotDeleteLocalBackup
: By default local backup files will be deleted after they have been uploaded. Enable this option do disable this behavior.
Use unzip <FileName>
to unzip your file. You'll be asked for a password when decrypting.