This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
storage:ibm_cos [2024/07/27 10:36] manu [Bucket Object Lock] |
storage:ibm_cos [2024/07/27 12:37] (current) manu |
||
---|---|---|---|
Line 152: | Line 152: | ||
* Create bucket and run commands to enable Versioning and Object Lock on the individual bucket. | * Create bucket and run commands to enable Versioning and Object Lock on the individual bucket. | ||
+ | __NOTE__ Enabling Object lock will not affect the existing vaults. | ||
+ | |||
+ | The below is an example which I tried in my lab to enable Versioning and then Object Lock. Maybe you can try | ||
+ | replicating the same to see if it works. | ||
+ | |||
+ | ==== create bucket ==== | ||
+ | |||
+ | <cli prompt='%'> | ||
+ | % curl -X PUT http://10.10.64.98:8337/container/testlockbucket -u jeff:password -d '{"storage_location":"cv1","service_instance":"jeff1"}' -H "Content-Type: application/json" | ||
+ | </cli> | ||
+ | <code> | ||
+ | { | ||
+ | "storage_location":"76c978d7-3e92-7946-11b8-2f8dd0e56865", | ||
+ | "name":"testlockbucket", | ||
+ | "service_instance":"jeff1", | ||
+ | "acl": { | ||
+ | "jeff1@00000000-0000-0000-0000-000000000002":["FULL_CONTROL"] | ||
+ | }, | ||
+ | "retention_policy": { | ||
+ | "status":"COMPLIANCE", | ||
+ | "permanent_retention_enabled":false | ||
+ | }, | ||
+ | "hard_quota":0, | ||
+ | "time_created":"2024-06-21T07:38:25.146Z", | ||
+ | "time_updated":"2024-06-21T07:38:25.155Z", | ||
+ | "versioning_state":"Disabled", | ||
+ | "has_replication":"Not Present" | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== check versioning status ==== | ||
+ | |||
+ | <cli prompt='%'> | ||
+ | % aws s3api get-bucket-versioning --endpoint-url http://10.10.64.98 --bucket testlockbucket --profile jeff-lab2 | ||
+ | </cli> | ||
+ | |||
+ | ==== enable versioning ==== | ||
+ | |||
+ | <cli prompt='%'> | ||
+ | % aws s3api put-bucket-versioning --endpoint-url http://10.10.64.98 --bucket testlockbucket --versioning-configuration | ||
+ | </cli> | ||
+ | <code> | ||
+ | Status=Enabled --profile jeff-lab2 | ||
+ | </code> | ||
+ | <cli prompt='%'> | ||
+ | % aws s3api get-bucket-versioning --endpoint-url http://10.10.64.98 --bucket testlockbucket --profile jeff-lab2 | ||
+ | </cli> | ||
+ | <code> | ||
+ | { | ||
+ | "Status": "Enabled" | ||
+ | } | ||
+ | </code> | ||
+ | |||
+ | ==== check object lock status ==== | ||
+ | |||
+ | <cli prompt='%'> | ||
+ | % aws s3api get-object-lock-configuration --endpoint-url http://10.10.64.98 --bucket testlockbucket --profile jeff-lab2 | ||
+ | </cli> | ||
+ | <code> | ||
+ | An error occurred (ObjectLockConfigurationNotFoundError) when calling the GetObjectLockConfiguration operation: | ||
+ | Object Lock configuration does not exist for this bucket | ||
+ | </code> | ||
+ | |||
+ | ==== enable object lock ==== | ||
+ | |||
+ | <cli prompt='%'> | ||
+ | % aws s3api put-object-lock-configuration --endpoint-url http://10.10.64.98 --bucket testlockbucket --object-lock-configuration ObjectLockEnabled=Enabled --profile jeff-lab2 | ||
+ | </cli> | ||
+ | <cli prompt='%'> | ||
+ | % aws s3api get-object-lock-configuration --endpoint-url http://10.10.64.98 --bucket testlockbucket --profile jeff-lab2 | ||
+ | </cli> | ||
+ | <code> | ||
+ | { | ||
+ | "ObjectLockConfiguration": { | ||
+ | "ObjectLockEnabled": "Enabled" | ||
+ | } | ||
+ | } | ||
+ | </code> | ||