Skip to content

Commit 7fba2e7

Browse files
Oxyjundaisyfaithauma
authored andcommitted
[R2] Adding workflow for using Rclone to upload to R2 (#21227)
* Initiating tutorial * Adding Rclone tutorial. * Iterating feedback * Offloading config into into the Rclone example. Cutting down wording in the Uploads chapter. * Adding back useful code comment * Adding emphasis on uploading concurrently. * Implementing feedback * Catching capitalisations in titles * Informing users that they can upload via API in the opening sentence.
1 parent 22f8bbb commit 7fba2e7

File tree

2 files changed

+55
-5
lines changed

2 files changed

+55
-5
lines changed

src/content/docs/r2/examples/rclone.mdx

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,43 @@
11
---
2-
title: rclone
2+
title: Rclone
33
pcx_content_type: example
44
---
55

6-
import { Render } from "~/components";
6+
import { Render, Steps } from "~/components";
77

88
<Render file="keys" />
99
<br />
1010

11+
Rclone is a command-line tool which manages files on cloud storage. You can use rclone to upload objects to R2 concurrently.
12+
13+
## Configure rclone
14+
1115
With [`rclone`](https://rclone.org/install/) installed, you may run [`rclone config`](https://rclone.org/s3/) to configure a new S3 storage provider. You will be prompted with a series of questions for the new provider details.
1216

1317
:::note[Recommendation]
14-
1518
It is recommended that you choose a unique provider name and then rely on all default answers to the prompts.
1619

1720
This will create a `rclone` configuration file, which you can then modify with the preset configuration given below.
1821
:::
1922

20-
:::note
23+
<Steps>
24+
1. Create new remote by selecting `n`.
25+
2. Select a name for the new remote. For example, use `r2`.
26+
3. Select the `Amazon S3 Compliant Storage Providers` storage type.
27+
4. Select `Cloudflare R2 storage` for the provider.
28+
5. Select whether you would like to enter AWS credentials manually, or get it from the runtime environment.
29+
6. Enter the AWS Access Key ID.
30+
7. Enter AWS Secret Access Key (password).
31+
8. Select the region to connect to (optional).
32+
9. Select the S3 API endpoint.
33+
</Steps>
2134

35+
:::note
2236
Ensure you are running `rclone` v1.59 or greater ([rclone downloads](https://beta.rclone.org/)). Versions prior to v1.59 may return `HTTP 401: Unauthorized` errors, as earlier versions of `rclone` do not strictly align to the S3 specification in all cases.
2337
:::
2438

39+
### Edit an existing rclone configuration
40+
2541
If you have already configured `rclone` in the past, you may run `rclone config file` to print the location of your `rclone` configuration file:
2642

2743
```sh

src/content/docs/r2/objects/upload-objects.mdx

Lines changed: 35 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,44 @@ sidebar:
55
order: 1
66
---
77

8-
You can upload objects to your bucket from the Cloudflare dashboard or using the Wrangler.
8+
import { Steps, Tabs, TabItem } from "~/components"
9+
10+
You can upload objects to your bucket from using API (both [Workers Binding API](/r2/api/workers/workers-api-reference/) or [compatible S3 API](/r2/api/s3/api/)), rclone, Cloudflare dashboard, or Wrangler.
11+
12+
## Upload objects via Rclone
13+
14+
Rclone is a command-line tool which manages files on cloud storage. You can use rclone to upload objects to R2. Rclone is useful if you wish to upload multiple objects concurrently.
15+
16+
To use rclone, install it onto your machine using their official documentation - [Install rclone](https://rclone.org/install/).
17+
18+
Upload your files to R2 using the `rclone copy` command.
19+
20+
```sh
21+
# Upload a single file
22+
rclone copy /path/to/local/file.txt r2:bucket_name
23+
24+
# Upload everything in a directory
25+
rclone copy /path/to/local/folder r2:bucket_name
26+
```
27+
28+
Verify that your files have been uploaded by listing the objects stored in the destination R2 bucket using `rclone ls` command.
29+
30+
```sh
31+
rclone ls r2:bucket_name
32+
```
33+
34+
For more information, refer to our [rclone example](/r2/examples/rclone/).
935

1036
## Upload objects via the Cloudflare dashboard
1137

1238
To upload objects to your bucket from the Cloudflare dashboard:
1339

40+
<Steps>
1441
1. Log in to the [Cloudflare dashboard](https://dash.cloudflare.com) and select **R2**.
1542
2. From the **R2** page in the dashboard, locate and select your bucket.
1643
3. Select **Upload**.
1744
4. Choose to either drag and drop your file into the upload area or **select from computer**.
45+
</Steps>
1846

1947
You will receive a confirmation message after a successful upload.
2048

@@ -38,3 +66,9 @@ Upload complete.
3866
```
3967

4068
You can set the `Content-Type` (MIME type), `Content-Disposition`, `Cache-Control` and other HTTP header metadata through optional flags.
69+
70+
:::note
71+
Wrangler's `object put` command only allows you to upload one object at a time.
72+
73+
Use rclone if you wish to upload multiple objects to R2.
74+
:::

0 commit comments

Comments
 (0)