Use cloudflare R2 Backup data
Use Rclone access R2.
BUILD - Storage & Databases - R2 object storage - Overview
- navigate 'Create bucket' on the top right
BUILD - Storage & Databases - R2 object storage - Overview
navigate 'Manage API tokens' on the top right
Create Account API Token
- Permissions, check 'Object Read & Write'
copy following
- Token value
abc...-def... - Access Key Id
abc... - Secret Access Key
abc... - Use jurisdiction-specific endpoints for S3 clients: https://abc...def.r2.cloudflarestorage.com
Install rclone on Ubuntu: sudo snap install rclone
Print configuration file full path: rclone config file
Specify config file: rclone tree --config /full/path/to/rclone.conf r2:
List all buckets rclone tree <config-section-name>:
List all files: rclone tree <config-section-name>:<your-bucket-name>
Upload a file: rclone copy dat.txt r2:backup/
Upload a file in chunks: rclone copy long-video.mp4 r2:user-uploads/ --s3-upload-cutoff=100M --s3-chunk-size=100M
Download a file: rclone copy r2:backup/dat.txt .
Delete a folder: rclone delete r2:backup/path/to/folder
Copy a folder in dry-run mode:
rclone \
--progress \
--dry-run \
--config /full/path/to/rclone.conf \
--include-from /path/to/include-from.txt \
copy /path/to/src/ \
r2:backup/path/to/dest \Backup ansible folder to R2:
rclone copy -v --include-from include-from.txt `pwd`/ r2:backup/`date +%Y%m%d`/include-from.txt
/ansible/**
# ...