Object lifecycle in a bucket
VK Object Storage allows you to configure the lifecycle of objects in a bucket. A lifecycle is the automated deletion of objects from a bucket according to specified rules.
-
Go to the VK Cloud management console.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Open the bucket settings in one of the following ways:
- Click
for the desired bucket and select Settings.
- Click the name of the desired bucket, then on the bucket page click the
button.
- Click
-
Go to the Lifecycle tab.
-
Go to the VK Cloud management console.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Open the bucket settings in one of the following ways:
- Click
for the desired bucket and select Settings.
- Click the name of the desired bucket, then on the bucket page click the
button.
- Click
-
Go to the Lifecycle tab.
-
Click the Add rule button or
Add new rule, if the bucket already has added rules.
-
Set the rule parameters:
- Rule name: only digits, Latin letters, and the characters
-,_,.are allowed. The name must be unique within the bucket. - Object key prefix: the rule will be applied only to objects with the specified prefix keys. The filter can contain only one key. Examples of prefix keys:
image/,pre/,image/photo. - Delete data after a specified number of days: specify the number of days after which the objects will be deleted.
- Activate the rule: disable the option if the rule being added should not currently be applied to objects.
- Rule name: only digits, Latin letters, and the characters
-
Click the Add rule button.
-
Go to the VK Cloud management console.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Open the bucket settings in one of the following ways:
- Click
for the desired bucket and select Settings.
- Click the name of the desired bucket, then on the bucket page click the
button.
- Click
-
Go to the Lifecycle tab.
-
Click the
icon for the rule you want to edit.
-
Edit the rule parameters.
-
Click the Save button.
To prevent objects from being deleted according to a specified rule, disable it:
-
Go to the VK Cloud management console.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Open the bucket settings in one of the following ways:
- Click
for the desired bucket and select Settings.
- Click the name of the desired bucket, then on the bucket page click the
button.
- Click
-
Go to the Lifecycle tab.
-
Disable the desired rule on the right.
-
Go to the VK Cloud management console.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Open the bucket settings in one of the following ways:
- Click
for the desired bucket and select Settings.
- Click the name of the desired bucket, then on the bucket page click the
button.
- Click
-
Go to the Lifecycle tab.
-
Click the
icon for the rule you want to delete.
-
Confirm the deletion.
-
Install and configure AWS CLI, if it is not installed yet.
-
Prepare a file in JSON format with the lifecycle rules configuration.
-
Open the console and run the command:
aws s3api put-bucket-lifecycle-configuration --bucket <BUCKET_NAME> --lifecycle-configuration file://<FILE_NAME>.json --endpoint-url <ENDPOINT_URL>Where:
-
<BUCKET_NAME>— the name of the bucket to which you want to add the rules configuration. -
<FILE_NAME>— the name of the file with the lifecycle rules configuration. -
<ENDPOINT_URL>— must match the account region:https://hb.vkcloud-storage.ruorhttps://hb.ru-msk.vkcloud-storage.ru— for the Moscow region;https://hb.kz-ast.vkcloud-storage.ru— for the Kazakhstan region.
-
-
Install and configure AWS CLI, if it is not installed yet.
-
Run the command in the console:
aws s3api delete-bucket-lifecycle --bucket <BUCKET_NAME> --endpoint-url <ENDPOINT_URL>Where:
-
<BUCKET_NAME>— the name of the bucket whose rules configuration you want to delete. -
<ENDPOINT_URL>— must match the account region:https://hb.vkcloud-storage.ruorhttps://hb.ru-msk.vkcloud-storage.ru— for the Moscow region;https://hb.kz-ast.vkcloud-storage.ru— for the Kazakhstan region.
-