Skip to content

Commit e01325c

Browse files
OxyjunMaddy-Cloudflareaninibread
authored andcommitted
[R2] Improving visibility of common use-cases (cloudflare#22687)
* Adding a partial file to direct users to WB API * Surfacing link to Access <> R2 tutorial page for better discoverability. * Adding example of copying object using aws s3api * Switching order of links * Apply suggestions from code review Co-authored-by: Maddy <[email protected]> * Update src/content/docs/r2/buckets/storage-classes.mdx Co-authored-by: Anni Wang <[email protected]> --------- Co-authored-by: Maddy <[email protected]> Co-authored-by: Anni Wang <[email protected]>
1 parent ea59391 commit e01325c

File tree

10 files changed

+55
-51
lines changed

10 files changed

+55
-51
lines changed

src/content/docs/r2/buckets/create-buckets.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,5 +47,6 @@ wrangler r2 bucket delete BUCKET_TO_DELETE
4747

4848
## Notes
4949

50-
- Bucket names and buckets are not public by default. To allow public access to a bucket, [visit the public bucket documentation](/r2/buckets/public-buckets/).
50+
- Bucket names and buckets are not public by default. To allow public access to a bucket, refer to [Public buckets](/r2/buckets/public-buckets/).
51+
- For information on controlling access to your R2 bucket with Cloudflare Access, refer to [Protect an R2 Bucket with Cloudflare Access](/r2/tutorials/cloudflare-access/).
5152
- Invalid (unauthorized) access attempts to private buckets do not incur R2 operations charges against that bucket. Refer to the [R2 pricing FAQ](/r2/pricing/#frequently-asked-questions) to understand what operations are billed vs. not billed.

src/content/docs/r2/buckets/public-buckets.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ For more information on default Cache behavior and how to customize it, refer to
4444

4545
To restrict access to your custom domain's bucket, use Cloudflare's existing security products.
4646

47-
- [Cloudflare Zero Trust Access](/cloudflare-one/applications/configure-apps): Protects buckets that should only be accessible by your teammates.
47+
- [Cloudflare Zero Trust Access](/cloudflare-one/applications/configure-apps): Protects buckets that should only be accessible by your teammates. Refer to [Protect an R2 Bucket with Cloudflare Access](/r2/tutorials/cloudflare-access/) tutorial for more information.
4848
- [Cloudflare WAF Token Authentication](/waf/custom-rules/use-cases/configure-token-authentication/): Restricts access to documents, files, and media to selected users by providing them with an access token.
4949

5050
:::caution

src/content/docs/r2/buckets/storage-classes.mdx

Lines changed: 25 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ pcx_content_type: how-to
44

55
---
66

7-
import { Badge } from "~/components"
7+
import { Badge, Tabs, TabItem } from "~/components"
88

99
Storage classes allow you to trade off between the cost of storage and the cost of accessing data. Every object stored in R2 has an associated storage class.
1010

@@ -16,50 +16,10 @@ All storage classes share the following characteristics:
1616

1717
## Available storage classes
1818

19-
<table>
20-
<tbody>
21-
<th style="width:25%">
22-
Storage class
23-
</th>
24-
<th style="width:25%">
25-
Minimum storage duration
26-
</th>
27-
<th style="width:25%">
28-
Data retrieval fees (processing)
29-
</th>
30-
<th style="width:25%">
31-
Egress fees (data transfer to Internet)
32-
</th>
33-
<tr>
34-
<td>
35-
Standard
36-
</td>
37-
<td>
38-
None
39-
</td>
40-
<td>
41-
None
42-
</td>
43-
<td>
44-
None
45-
</td>
46-
</tr>
47-
<tr>
48-
<td>
49-
Infrequent Access <inline-pill style="beta" />
50-
</td>
51-
<td>
52-
30 days
53-
</td>
54-
<td>
55-
Yes
56-
</td>
57-
<td>
58-
None
59-
</td>
60-
</tr>
61-
</tbody>
62-
</table>
19+
| Storage class | Minimum storage duration | Data retrieval fees (processing) | Egress fees (data transfer to Internet) |
20+
|--------------------------------|---------------------------|----------------------------------|------------------------------------------|
21+
| Standard | None | None | None |
22+
| Infrequent Access | 30 days | Yes | None |
6323

6424
For more information on how storage classes impact pricing, refer to [Pricing](/r2/pricing/).
6525

@@ -124,3 +84,23 @@ Once an object is stored in Infrequent Access, it cannot be transitioned to Stan
12484
:::
12585

12686
To learn more about how to transition objects from Standard storage to Infrequent Access storage, refer to [Object lifecycles](/r2/buckets/object-lifecycles/).
87+
88+
## Change storage class for objects
89+
90+
You can change the storage class of an object which is already stored in R2 using the [`CopyObject` API](https://docs.aws.amazon.com/AmazonS3/latest/API/API_CopyObject.html).
91+
92+
Use the `x-amz-storage-class` header to change between `STANDARD` and `STANDARD_IA`.
93+
94+
An example of switching an object from `STANDARD` to `STANDARD_IA` using `aws cli` is shown below:
95+
96+
```sh
97+
aws s3api copy-object \
98+
--endpoint-url https://<ACCONUT_ID>.r2.cloudflarestorage.com \
99+
--bucket bucket-name \
100+
--key path/to/object.txt \
101+
--copy-source /bucket-name/path/to/object.txt \
102+
--storage-class STANDARD_IA
103+
```
104+
105+
- Refer to [aws CLI](/r2/examples/aws/aws-cli/) for more information on using `aws CLI`.
106+
- Refer to [object-level operations](/r2/api/s3/api/#object-level-operations) for the full list of object-level API operations with R2-compatible S3 API.

src/content/docs/r2/get-started.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,6 @@ You will receive a confirmation message after a successful upload.
5757

5858
Cloudflare provides multiple ways for developers to access their R2 buckets:
5959

60-
- [Workers Runtime API](/r2/api/workers/workers-api-usage/)
60+
- [R2 Workers Binding API](/r2/api/workers/workers-api-usage/)
6161
- [S3 API compatibility](/r2/api/s3/api/)
6262
- [Public buckets](/r2/buckets/public-buckets/)

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar:
55
order: 3
66
---
77

8+
import { Render } from "~/components";
9+
810
You can delete objects from your bucket from the Cloudflare dashboard or using the Wrangler.
911

1012
## Delete objects via the Cloudflare dashboard
@@ -36,3 +38,5 @@ wrangler r2 object delete test-bucket/foo.png
3638
Deleting object "foo.png" from bucket "test-bucket".
3739
Delete complete.
3840
```
41+
42+
<Render file="link-to-workers-r2-api" product="r2"/>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ sidebar:
55
order: 2
66
---
77

8+
import { Render } from "~/components";
9+
810
You can download objects from your bucket from the Cloudflare dashboard or using the Wrangler.
911

1012
## Download objects via the Cloudflare dashboard
@@ -30,3 +32,5 @@ Download complete.
3032
```
3133

3234
The file will be downloaded into the current working directory. You can also use the `--file` flag to set a new name for the object as it is downloaded, and the `--pipe` flag to pipe the download to standard output (stdout).
35+
36+
<Render file="link-to-workers-r2-api" product="r2"/>

src/content/docs/r2/objects/index.mdx

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,10 @@ sidebar:
66

77
---
88

9-
import { DirectoryListing } from "~/components"
9+
import { DirectoryListing, Render } from "~/components"
1010

1111
Objects are individual files or data that you store in an R2 bucket.
1212

1313
<DirectoryListing />
14+
15+
<Render file="link-to-workers-r2-api" product="r2"/>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ sidebar:
66

77
---
88

9+
import { Render } from "~/components";
10+
911
R2 supports [S3 API's Multipart Upload](https://docs.aws.amazon.com/AmazonS3/latest/userguide/mpuoverview.html) with some limitations.
1012

1113
## Limitations
@@ -34,3 +36,5 @@ Note that the binary MD5 sums themselves are concatenated and then summed, not t
3436
echo -n $(echo -n bce6bf66aeb76c7040fdd5f4eccb78e6 | xxd -r -p -)\
3537
$(echo -n 8165449fc15bbf43d3b674595cbcc406 | xxd -r -p -) | md5sum
3638
```
39+
40+
<Render file="link-to-workers-r2-api" product="r2"/>

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

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ sidebar:
55
order: 1
66
---
77

8-
import { Steps, Tabs, TabItem } from "~/components"
8+
import { Steps, Tabs, TabItem, Render } from "~/components"
99

1010
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.
1111

@@ -71,4 +71,6 @@ You can set the `Content-Type` (MIME type), `Content-Disposition`, `Cache-Contro
7171
Wrangler's `object put` command only allows you to upload one object at a time.
7272

7373
Use rclone if you wish to upload multiple objects to R2.
74-
:::
74+
:::
75+
76+
<Render file="link-to-workers-r2-api" product="r2"/>
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
{}
3+
---
4+
5+
## Other resources
6+
7+
For information on R2 Workers Binding API, refer to [R2 Workers API reference](/r2/api/workers/workers-api-reference/).

0 commit comments

Comments
 (0)