Script to easily backup personal files to Amazon S3 paying only $3.70 per TB per month.
See the blog post for the full context and explanation.
Attention! Usage will incur S3 usage charges.
With default parameters, used storage class is GLACIER,
with objects billed for storage for 90 days minimum.
Install with Homebrew:
brew install rclone parallel
Deploy CloudFormation stack with the S3 bucket and IAM user:
aws cloudformation deploy --stack-name backupToS3 --template-file stack.yml --capabilities CAPABILITY_IAM
Get the bucket name and IAM user name from the CloudFormation Outputs in AWS Console.
Go to the IAM, open that user details, and create an access key in the "Security credentials" tab.
Configure rclone by running rclone config
or manually editing configuration file (~/.config/rclone/rclone.conf
):
[backup]
type = s3
provider = aws
env_auth = false
access_key_id = xxxxxx
secret_access_key = xxxxxx
acl = private
region = eu-west-1
Provide generated IAM user credentials for access_key_id
and secret_access_key
.
To backup directory as a single archive:
./backup.sh --bucket backuptos3-backupbucket-xxxxxxxxxxxxx --name my_disk --path /mnt/disk0
To backup each subdirectory as a separate archive:
./backup.sh --bucket backuptos3-backupbucket-xxxxxxxxxxxxx --name my_disk --path /mnt/disk0 --split-depth 1
Use ./backup.sh --help
for more info.