Skip to content

Commit 60b373a

Browse files
committed
Adding example of copying object using aws s3api
1 parent cc0a310 commit 60b373a

File tree

1 file changed

+25
-45
lines changed

1 file changed

+25
-45
lines changed

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 --endpoint-url https://<ACCONUT_ID>.r2.cloudflarestorage.com \
98+
--copy-object \
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 [object-level operations](/r2/api/s3/api/#object-level-operations) for the full list of object-level API operations with R2-compatible S3 API.
106+
- Refer to [aws CLI](/r2/examples/aws/aws-cli/) for more information on using `aws CLI`.

0 commit comments

Comments
 (0)