Object Lock: Create a Bucket with Object Lock
Zuletzt aktualisiert am
Object Lock can only be enabled at the time the bucket is created. It cannot be activated on existing buckets or disabled after creation.
Prerequisites
Section titled “Prerequisites”- The project-level Compliance Lock must be active
- Appropriate project permissions
Create a bucket with Object Lock
Section titled “Create a bucket with Object Lock”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"}Possible errors
Section titled “Possible errors”| Status | Reason |
|---|---|
| 404 | Project not found |
| 409 | Compliance Lock is not active (must be enabled first) |
| 409 | A bucket with this name already exists |
What happens next
Section titled “What happens next”Once a bucket is created with Object Lock enabled:
- Versioning is automatically enabled — Object Lock requires bucket versioning. It is turned on automatically and cannot be suspended.
- You can configure a default retention policy — See Configure Default Retention to set an automatic retention period for all new objects in the bucket.
- You can set per-object retention — Use the S3-compatible API to set retention on individual objects. See Object-level Retention via S3 API.
Important notes
Section titled “Important notes”- 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
objectLockEnabledparameter or set it tofalse. - A bucket name must be DNS-conformant (3—63 characters).