rclone
You must generate an Access Key before getting started. All examples will utilize 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 config
↗ 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:
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:
You may then use the new rclone
provider for any of your normal workflows.
The rclone tree ↗ command can be used to list the contents of the remote, in this case Cloudflare R2.
The rclone copy ↗ command can be used to upload objects to an R2 bucket and vice versa - this allows you to upload files up to the 5 TB maximum object size that R2 supports.
For multipart uploads, part sizes can significantly affect the number of Class A operations that are used, which can alter how much you end up being charged.
Every part upload counts as a separate operation, so larger part sizes will use fewer operations, but might be costly to retry if the upload fails. Also consider that a multipart upload is always going to consume at least 3 times as many operations as a single PutObject
, because it will include at least one CreateMultipartUpload
, UploadPart
& CompleteMultipartUpload
operations.
Balancing part size depends heavily on your use-case, but these factors can help you minimize your bill, so they are worth thinking about.
You can configure rclone’s multipart upload part size using the --s3-chunk-size
CLI argument. Note that you might also have to adjust the --s3-upload-cutoff
argument to ensure that rclone is using multipart uploads. Both of these can be set in your configuration file as well. Generally, --s3-upload-cutoff
will be no less than --s3-chunk-size
.
You can also generate presigned links which allow you to share public access to a file temporarily using the rclone link ↗ command.