How to configure S3 bucket backup

On senhasegura is possible to do backup on AWS bucket (S3). To it, you need to have the information below:

1. AWS Access Key ID (must);
2. AWS Secret Access Key (must);
3. Default region-name. If not informed, to default is the AWS server region.

IMPORTANT: ATTENTION ON VARIABLES BETWEEN {}. IT MUST CHANGE TO REAL VALUE.

1. Run the command to configure the S3:

aws s3 sync /var/orbini/backup/senhasegura s3://{your_bucket_name}/{your_folder_name}

Exemple:

aws s3 sync /var/orbini/backup/senhasegura s3://backupSenhasegura/Master

2. Create the cron to it:

vim /etc/cron.d/aws_sync

3. Insert this content:

*/1 * * * * root /usr/local/bin/aws s3 sync /var/orbini/backup/senhasegura/ s3://{your_bucket_name}/{your_folder_name}/ 2> /dev/null 1>/dev/null

*/10 * * * * root /usr/local/bin/aws s3 sync /var/senhasegura/arz/ s3://{your_bucket_name}/{your_folder_name}/ 2> /dev/null 1>/dev/null

*/1 * * * * root /usr/local/bin/aws s3 sync /srv/cache/coba/ s3://{your_bucket_name}/{your_folder_name}/ 2> /dev/null 1>/dev/null

image

4. Restart the cron service.

systemctl restart cron

3 Likes