Object Lock
The default temporary lock (DefaultRetention) is set at the bucket level. It applies to all new objects uploaded to the bucket and does not apply to objects that have already been uploaded.
Setting a default lock is optional.
To manage the default temporary lock:
-
Go to the VK Cloud management console.
-
Enable versioning, if this has not been done before.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Go to 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 Lock tab.
-
Enable object locking, if this has not been done before.
-
Enable the Lock objects by default option.
-
Select the protection mode:
Governance— governance mode that allows the lock to be bypassed;Compliance— strict mode that does not allow the lock to be removed until the specified period expires.
-
Select the retention period in days.
-
Click the Save button.
A permanent lock (legal hold) can be set both when uploading an object to a bucket and for an object already in the bucket. Only a user with WRITE permissions can set and remove such a lock.
To manage a permanent lock:
-
Go to the VK Cloud management console.
-
Enable versioning, if this has not been done before.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Click the name of the bucket.
-
Click the name of the object.
-
Go to the Versioning tab. Make sure it is enabled.
-
Go to the Lock tab.
-
Enable object locking, if this has not been done before.
-
Click the
icon.
-
Enable or disable the Permanent lock option.
-
Click Apply.
A retention period can be set both when uploading an object to a bucket and for an object that is already in the bucket.
To manage a retention period:
-
Go to the VK Cloud management console.
-
Enable versioning, if this has not been done before.
-
Select the project that contains the desired bucket.
-
Go to the Object Storage → Buckets section.
-
Click the name of the bucket.
-
Click the name of the object.
-
Go to the Versioning tab. Make sure it is enabled.
-
Go to the Lock tab.
-
Enable object locking, if this has not been done before.
-
Click the
icon.
-
Enable or disable the Retention period option.
-
If you have enabled the Retention period option, select the protection mode:
Governance— governance mode that allows the lock to be bypassed;Compliance— strict mode that does not allow the lock to be removed until the specified period expires.
-
If you have enabled the Retention period option, specify the date and time when the lock expires. The minimum value is 24 hours from the moment the lock is set.
-
Click Apply.
A user who has WRITE permissions can bypass a retention lock in GOVERNANCE mode by using the --bypass-governance-retention flag in commands. By bypassing the lock, they can:
- delete the object before the lock period expires;
- remove the retention lock;
- shorten the lock period;
- change the mode to
COMPLIANCE.
To perform an action bypassing the lock:
-
Install and configure the AWS CLI, if it is not installed yet.
-
Open the console and perform the desired action.
Delete an objectRemove the lockShorten the periodChange the modeTo delete an object that has a governance retention lock, run the command:
aws s3api delete-object \--bucket <BUCKET_NAME> \--key <OBJECT_KEY> \--version-id <VERSION_ID> \--bypass-governance-retention \--endpoint-url <ENDPOINT_URL>Here:
-
<BUCKET_NAME>— name of the bucket that contains the desired object. -
<OBJECT_KEY>— full name of the object, including its path. -
(Optional)
<VERSION_ID>— the identifier of the locked object version to delete. If the--version-idparameter is not specified, a delete marker will be created instead of a deletion, and it will become the current version. The previous version will remain in the bucket. For more information, see Deleting an object or its version.If you specify an object version that is a delete marker, the previous version becomes the current version.
-
<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.
-