Skip to content

Object Lock: Create a Bucket with Object Lock

Last updated on

Object Lock can only be enabled at the time the bucket is created. It cannot be activated on existing buckets or disabled after creation.

  • The project-level Compliance Lock must be active
  • Appropriate project permissions

Add the objectLockEnabled=true query parameter when creating a bucket:

curl -X POST \
"https://object-storage.api.{region}.stackit.cloud/v1/project/{projectId}/bucket/{bucketName}?objectLockEnabled=true" \
-H "Authorization: Bearer $TOKEN"

Response (HTTP 201):

{
"project": "cd5e788d-5b7b-4ab9-a20d-e790205df10b",
"bucket": "my-compliant-bucket"
}

Once a bucket is created with Object Lock enabled:

  1. Versioning is automatically enabled — Object Lock requires bucket versioning. It is turned on automatically and cannot be suspended.
  2. You can configure a default retention policy — See Configure Default Retention to set an automatic retention period for all new objects in the bucket.
  3. You can set per-object retention — Use the S3-compatible API to set retention on individual objects. See Object-level Retention via S3 API.
  • Object Lock cannot be disabled after bucket creation.
  • You can still create buckets without Object Lock in a project that has the Compliance Lock enabled — simply omit the objectLockEnabled parameter or set it to false.
  • A bucket name must be DNS-conformant (3—63 characters).