|
1 | 1 | ---
|
2 | 2 | title: 'Object Storage - Getting Started with Versioning'
|
3 | 3 | excerpt: 'Learn how to enable and manage versioning for your OVHcloud Object Storage buckets using APIs'
|
4 |
| -updated: 2024-07-08 |
| 4 | +updated: 2025-07-07 |
5 | 5 | ---
|
6 | 6 |
|
7 |
| -> [!primary] |
8 |
| -> This guide documents API usage only. Future updates will cover the OVHcloud Control Panel. |
9 |
| -
|
10 | 7 | ## Objective
|
11 | 8 |
|
12 | 9 | **This guide explains how to enable and manage versioning for your OVHcloud Object Storage buckets using APIs.**
|
@@ -82,39 +79,137 @@ When versioning is enabled:
|
82 | 79 |
|
83 | 80 | ### How to Enable Versioning
|
84 | 81 |
|
85 |
| -#### Using the AWS CLI |
86 |
| - |
87 |
| -To enable versioning on an Object Storage bucket, use the following command: |
88 |
| - |
89 |
| -```sh |
90 |
| -aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled |
91 |
| -``` |
92 |
| - |
93 |
| -**Explanation:** |
94 |
| - |
95 |
| -- **put-bucket-versioning:** AWS CLI command to configure versioning. |
96 |
| -- **--bucket my-bucket:** Replace `my-bucket` with the name of your bucket. |
97 |
| -- **--versioning-configuration Status=Enabled:** Enables versioning for the specified bucket. |
98 |
| - |
99 |
| -After enabling versioning, all objects added to the bucket will have a unique version ID. This means that every time an object is modified or deleted, a new version is created, which can be restored if needed. |
| 82 | +> [!tabs] |
| 83 | +> Via AWS CLI |
| 84 | +>> To enable versioning on an Object Storage bucket, use the following command: |
| 85 | +>> |
| 86 | +>> ```sh |
| 87 | +>> aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Enabled |
| 88 | +>> ``` |
| 89 | +>> |
| 90 | +>> **Explanations:** |
| 91 | +>> |
| 92 | +>> - `put-bucket-versioning`: AWS CLI command to configure version management. |
| 93 | +>> - `--bucket my-bucket`: replace `my-bucket` with the name of your bucket. |
| 94 | +>> - `--versioning-configuration Status=Enabled`: enable versioning for the specified bucket. |
| 95 | +>> |
| 96 | +>> After enabling versioning, all objects added to the bucket will have a unique version identifier. This means that each time an object is modified or deleted, a new version is created, which can be restored if necessary. |
| 97 | +>> |
| 98 | +> Via the OVHcloud Control Panel |
| 99 | +>> There are two ways to activate versioning on an Object Storage bucket: |
| 100 | +>> |
| 101 | +>> When creating the bucket, simply activate the versioning option in the associated step: |
| 102 | +>> |
| 103 | +>> {.thumbnail} |
| 104 | +>> |
| 105 | +>> On an existing bucket, by modifying its parameters via the OVHcloud dashboard. |
| 106 | +>> |
| 107 | +>> {.thumbnail} |
| 108 | +>> |
100 | 109 |
|
101 | 110 | ### How to Suspend Versioning
|
102 | 111 |
|
103 |
| -#### Using the AWS CLI |
104 |
| - |
105 |
| -To suspend versioning, set the versioning configuration status to `Suspended`: |
106 |
| - |
107 |
| -```sh |
108 |
| -aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Suspended |
109 |
| -``` |
| 112 | +> [!tabs] |
| 113 | +> Via AWS CLI |
| 114 | +>> To suspend versioning, set the versioning configuration status to `Suspended`: |
| 115 | +>> |
| 116 | +>> ```sh |
| 117 | +>> aws s3api put-bucket-versioning --bucket my-bucket --versioning-configuration Status=Suspended |
| 118 | +>> ``` |
| 119 | +>> |
| 120 | +>> **Explanations:** |
| 121 | +>> |
| 122 | +>> - `put-bucket-versioning`: AWS CLI command to configure versioning. |
| 123 | +>> - `--bucket my-bucket`: replace `my-bucket` with the name of your bucket. |
| 124 | +>> - `--versioning-configuration Status=Suspended`: suspend versioning for the specified bucket. |
| 125 | +>> |
| 126 | +>> Suspending versioning prevents new objects from receiving a version identifier. Existing objects and their versions remain unchanged, but new objects will not have version identifiers until versioning is reactivated. |
| 127 | +>> |
| 128 | +
|
| 129 | +### Manage and access object versions |
| 130 | +
|
| 131 | +#### View object versions |
| 132 | +
|
| 133 | +> [!tabs] |
| 134 | +> Via the OVHcloud Control Panel |
| 135 | +>> You can show or hide object versions in an Object Storage bucket by clicking on the following button: |
| 136 | +>> |
| 137 | +>> [enable version objects](images/bucket_enable_versions.png){.thumbnail} |
| 138 | +>> |
| 139 | +
|
| 140 | +#### View the different versions of an object |
| 141 | +
|
| 142 | +> ![tabs] |
| 143 | +> Via the OVHcloud Control Panel |
| 144 | +>> To view the different versions of an object, click directly on the object concerned. You'll be redirected to a page detailing the information and versions available for this object: |
| 145 | +>> |
| 146 | +>> {.thumbnail} |
| 147 | +>> |
| 148 | +
|
| 149 | +#### Download a current or previous version of an object |
| 150 | +
|
| 151 | +> [!tabs] |
| 152 | +> Via the OVHcloud Control Panel |
| 153 | +>> From the main page of your Object Storage bucket (if version display is enabled) or from the object details page (see previous step), you can download the desired version by clickin the `...`{.action} button, then on `Download`{.action}. |
| 154 | +>> |
| 155 | +>> {.thumbnail} |
| 156 | +>> |
| 157 | +
|
| 158 | +### Object deletion: simple, permanent deletion and Delete Marker management |
110 | 159 |
|
111 |
| -**Explanation:** |
112 |
| - |
113 |
| -- **put-bucket-versioning:** AWS CLI command to configure versioning. |
114 |
| -- **--bucket my-bucket:** Replace `my-bucket` with the name of your bucket. |
115 |
| -- **--versioning-configuration Status=Suspended:** Suspends versioning for the specified bucket. |
116 |
| - |
117 |
| -Suspending versioning stops new objects from receiving a version ID. Existing objects and their versions remain unchanged, but new objects will not have version IDs until versioning is re-enabled. |
| 160 | +> [!primary] |
| 161 | +> |
| 162 | +> If versioning is enabled on your S3 bucket, deleting an object adds a Delete Marker: the object disappears from the default view, but remains visible via the `View versions`{.action} option. |
| 163 | +> |
| 164 | +> This protection allows you to restore an object deleted by mistake. |
| 165 | +> |
| 166 | +
|
| 167 | +> [!tabs] |
| 168 | +> Via the OVHcloud Control Panel |
| 169 | +>> From the main page of your Object Storage bucket, or from the object details page, you can delete your object by clicking on `Delete`{.action}. |
| 170 | +>> |
| 171 | +>> {.thumbnail} |
| 172 | +>> |
| 173 | +>> To delete a version permanently, click the `...`{.action} button, then on `Delete`{.action}, and confirm the definitive deletion action. |
| 174 | +>> |
| 175 | +>> |
| 176 | +> Via the AWS CLI |
| 177 | +>> To delete an object, use the following command: |
| 178 | +>> |
| 179 | +>> ```bash |
| 180 | +>> aws s3api delete-object --bucket <bucket> --key <objet> |
| 181 | +>> ``` |
| 182 | +>> |
| 183 | +>> If you want to see the different versions of an object, use the following command: |
| 184 | +>> |
| 185 | +>> ```bash |
| 186 | +>> aws s3api list-object-versions --bucket <bucket> --prefix <objet> |
| 187 | +>> ``` |
| 188 | +>> |
| 189 | +>> To delete a specific version of an object: |
| 190 | +>> |
| 191 | +>> ```bash |
| 192 | +>> aws s3api list-object-versions --bucket <bucket> --prefix <objet> |
| 193 | +>> ``` |
| 194 | +>> |
| 195 | +>> If you wish to delete a `delete marker` to recover your object version, proceed as follows: |
| 196 | +>> |
| 197 | +>> - List delete markers and identify the version-id of the delete marker: |
| 198 | +>> |
| 199 | +>> ```bash |
| 200 | +>> aws s3api list-object-versions --bucket my-bucket --prefix my-object. txt \ |
| 201 | +>> --query "DeleteMarkers" --output json |
| 202 | +>> ``` |
| 203 | +>> |
| 204 | +>> - Delete this delete marker: |
| 205 | +>> |
| 206 | +>> ```bash |
| 207 | +>> aws s3api delete-object \ |
| 208 | +>> --bucket my-bucket \ |
| 209 | +>> --key my-object.txt \ |
| 210 | +>> --version-id <delete-marker-version-id> |
| 211 | +>> ``` |
| 212 | +>> |
118 | 213 |
|
119 | 214 | ### Important Considerations
|
120 | 215 |
|
|
0 commit comments