|
| 1 | +--- |
| 2 | +title: "RustFS Object Management" |
| 3 | +description: "Manage RustFS objects, including creation and deletion." |
| 4 | +--- |
| 5 | + |
| 6 | +# RustFS Objects |
| 7 | + |
| 8 | +An object is the basic storage unit in RustFS. It includes data, metadata, and a unique identifier (Object Key). This section uses file upload and deletion to illustrate object management. |
| 9 | + |
| 10 | +> For object-related concepts, see [Core Concepts](/concepts/glossary.md). |
| 11 | +
|
| 12 | +## Create an Object |
| 13 | + |
| 14 | +Prerequisites: |
| 15 | + |
| 16 | +- An available RustFS instance. See the [Installation Guide](/installation/index) to deploy one. |
| 17 | + |
| 18 | +[Create a bucket](bucket-create-and-delete.md) first, then upload a file into the bucket to create an object. You can upload via the RustFS UI, `mc`, or the S3-compatible API. |
| 19 | + |
| 20 | +### Upload a file via RustFS UI |
| 21 | + |
| 22 | +1. Sign in to the RustFS UI console. |
| 23 | +2. Select the target bucket. |
| 24 | +3. On the bucket page, use **New Directory**, **New File**, or **Upload Files/Folders** to create content. |
| 25 | +4. To upload from local, click **Upload Files/Folders**, choose local files/folders, then click **Start Upload**. |
| 26 | + |
| 27 | + |
| 28 | + |
| 29 | +After the upload completes, click the object to view its details. |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +### Upload a file with `mc` |
| 34 | + |
| 35 | +> For `mc` installation and configuration, see the [`mc` Guide](../mc.md). |
| 36 | +
|
| 37 | +Use `mc cp` to upload: |
| 38 | + |
| 39 | +``` |
| 40 | +# upload file |
| 41 | +mc cp 1.txt rustfs/bucket-creation-by-mc |
| 42 | +/tmp/1.txt: 13 B / 13 B ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓ 61 B/s 0s% |
| 43 | +
|
| 44 | +# confirm upload |
| 45 | +mc ls rustfs/bucket-creation-by-mc |
| 46 | +[2025-08-01 10:01:08 CST] 13B 1.txt |
| 47 | +``` |
| 48 | + |
| 49 | +You can also verify in the RustFS console. |
| 50 | + |
| 51 | +### Upload a file via API |
| 52 | + |
| 53 | +Use the following API to upload: |
| 54 | + |
| 55 | +``` |
| 56 | +PUT /{bucketName}/{objectName} HTTP/1.1 |
| 57 | +``` |
| 58 | + |
| 59 | +Example: |
| 60 | + |
| 61 | +``` |
| 62 | +curl --location --request PUT 'http://12.34.56.78:9000/bucket-creation-by-api/password.txt' \ |
| 63 | +--header 'Content-Type: text/plain' \ |
| 64 | +--header 'X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' \ |
| 65 | +--header 'X-Amz-Date: 20250801T024840Z' \ |
| 66 | +--header 'Authorization: AWS4-HMAC-SHA256 Credential=H4xcBZKQfvJjEnk3zp1N/20250801/cn-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=b7d8dc29ee34dfdf1f3e9e8e069892a8936f478586e7a2c90cf34f5b86d3a2dc' \ |
| 67 | +--data-binary '@/path/to/password.txt' |
| 68 | +``` |
| 69 | + |
| 70 | +Verify the upload in the RustFS console. |
| 71 | + |
| 72 | +## Delete an Object |
| 73 | + |
| 74 | +You can delete objects via the UI, `mc`, or API. For example, remove the file created in the steps above. |
| 75 | + |
| 76 | +## Delete a file via RustFS UI |
| 77 | + |
| 78 | +1. Sign in to the RustFS UI console. |
| 79 | +2. Select the bucket containing the file. |
| 80 | +3. On the bucket page, select the file to delete. |
| 81 | +4. Click **Delete Selected** in the upper right, then click **Confirm** in the dialog. |
| 82 | + |
| 83 | + |
| 84 | + |
| 85 | +### Delete a file with `mc` |
| 86 | + |
| 87 | +Use `mc rm` to delete: |
| 88 | + |
| 89 | +``` |
| 90 | +# delete file |
| 91 | +mc rm rustfs/bucket-creation-by-mc/1.txt |
| 92 | +Removed `rustfs/bucket-creation-by-mc/1.txt`. |
| 93 | +
|
| 94 | +# confirm deletion |
| 95 | +mc ls rustfs/bucket-creation-by-mc/1.txt |
| 96 | +``` |
| 97 | + |
| 98 | +You can confirm the deletion in the RustFS UI. |
| 99 | + |
| 100 | +### Delete a file via API |
| 101 | + |
| 102 | +Use the following API: |
| 103 | + |
| 104 | +``` |
| 105 | +DELETE /{bucketName}/{objectName} HTTP/1.1 |
| 106 | +``` |
| 107 | + |
| 108 | +Example: |
| 109 | + |
| 110 | +``` |
| 111 | +curl --location --request DELETE 'http://12.34.56.78:9000/bucket-creation-by-api/password.txt' \ |
| 112 | +--header 'Content-Type: text/plain' \ |
| 113 | +--header 'X-Amz-Content-Sha256: e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855' \ |
| 114 | +--header 'X-Amz-Date: 20250801T030822Z' \ |
| 115 | +--header 'Authorization: AWS4-HMAC-SHA256 Credential=H4xcBZKQfvJjEnk3zp1N/20250801/cn-east-1/s3/aws4_request, SignedHeaders=content-length;content-type;host;x-amz-content-sha256;x-amz-date, Signature=1ee63bb0b699598602b2fdbd013e355a57bcb9991307a8ad41f6512e8afebf3a' |
| 116 | +``` |
| 117 | + |
| 118 | +Verify the deletion in the RustFS UI. |
0 commit comments