Configure `rclone` for R2
Example of how to configure `rclone` to use R2.
You must generate an Access Key before getting started. All examples will utilitize access_key_id
and access_key_secret
variables which represent the Access Key ID and Secret Access Key values you generated.
With rclone
installed, you may run rclone configure
to configure a new S3 storage provider. You will be prompted with a series of questions for the new provider details.
If you have already configured rclone
in the past, you may run rclone config file
to print the location of your rclone
configuration file:
$ rclone config file
# Configuration file is stored at:
# ~/.config/rclone/rclone.conf
Then use an editor (nano
or vim
, for example) to add or edit the new provider. This example assumes you are adding a new r2demo
provider:
~/.config/rclone/rclone.conf[r2demo]
type = s3provider = Otheraccess_key_id = abc123 # Your access_key_id
secret_access_key = xyz456 # Your access_key_secret
endpoint = https://<accountid>.r2.cloudflarestorage.comacl = private
You may then use the new rclone
provider for any of your normal workflows.
$ rclone tree r2demo:
# /
# ├── user-uploads
# │ └── foobar.png
# └── my-bucket-name
# ├── cat.png
# └── todos.txt
$ rclone tree r2demo:my-bucket-name
# /
# ├── cat.png
# └── todos.txt