Before doing all this you have to create a bucket in your AWS console. Or just use AWS cli tool in order to create one.
Install pip (if not installed already):
$ curl -O https://bootstrap.pypa.io/get-pip.py
$ sudo pip install awscli
$ aws configure
AWS Access Key ID [None]: <YOUR_AWESOME_KEY>
AWS Secret Access Key [None]: <YOUR_AWESOME_KEY>
Default region name [None]: us-west-2
Default output format [None]: json
Backup old file, then open and edit Vesta command v-backup-user
:
$ cp /usr/local/vesta/bin/v-backup-user /usr/local/vesta/bin/v-backup-user_backup
$ sudo nano /usr/local/vesta/bin/v-backup-user
Somewhere in Variable&Function section add:
# AWS arguments
bucket=s3://<your_awesome_bucket_name>/$user/
Search for # Creating final tarball
section and right after this line chown admin:$user $BACKUP/$user.$DATE.tar
add new code:
# AWS UPLOAD
aws s3 cp $BACKUP/$user.$DATE.tar $bucket --storage-class REDUCED_REDUNDANCY
echo -e "$(date "+%F %T") AWS: Uploaded and backed. $user.$DATE.tar"
msg="$msg\n$(date "+%F %T") AWS: Uploaded and backed. $user.$DATE.tar"