#!/bin/bash
# Set variables
AWS_ACCESS_KEY_ID=<Your AWS access key>
AWS_SECRET_ACCESS_KEY=<Your AWS secret key>
S3_BUCKET=<Your S3 bucket name>
# Backup files
TIMESTAMP=$(date +%Y.%m.%d_%H.%M.%S)
# Sync files with S3 bucket
aws s3 sync . s3://$S3_BUCKET/backup_$TIMESTAMP --exclude "*" --include "*.conf" --include ".secret" --access_key $AWS_ACCESS_KEY_ID --secret_key $AWS_SECRET_ACCESS_KEY
# Run script every day
0 0 * * * /root/backup_files.sh