Throw backups into AWS S3 from the local server.
Every restaurant has a base sauce ready for different dishes, the same way I am sharing a base shell script to push backups into S3. You can modify the script as per the taste (^_-)
To begin with, you must install a Python environment followed by AWS CLI on your server first and configure it.
Then follows this shell script.
#!/bin/bash
set -x
cd <path>/s3data && rm -rf *
filelist=`cd <path> && find -maxdepth 1 -type d -mtime -1|grep epic|cut -d ‘/’ -f 2`
echo $filelist
cd <path> && tar -cvzf <name>_prod_daily-`date ‘+%D’|sed s/’\/’/-/g`.tgz $filelist && chmod 777 *.tgz && mv -f *.tgz s3data/
source <path>/aws/bin/activate
cd <path> && aws s3 cp s3data s3://<bucket-path>/<sub-directory> –grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers –recursive
deactivate