Docs

Object Lock (API)

This page describes the S3 operations that control Object Lock on chili. For the basics, such as governance mode, legal hold and setup, see Object Lock (WORM).

You enable Object Lock only when you create the bucket in the chili Console. An existing bucket without Object Lock cannot be switched over later through the API. With Object Lock, versioning is always on.

All examples use path style, the endpoint https://s3-ch-east.chilistorage.com and governance mode, which every account can use without activation. chili support enables compliance mode once for your account.

Operations

Operation

Method and path

Notes

PutObjectLockConfiguration

PUT /{bucket}?object-lock

Set default retention, Content-MD5 required

GetObjectLockConfiguration

GET /{bucket}?object-lock

Read the configuration

PutObjectRetention

PUT /{bucket}/{key}?retention&versionId={id}

Period per version, versionId required

GetObjectRetention

GET /{bucket}/{key}?retention&versionId={id}

versionId required

PutObjectLegalHold

PUT /{bucket}/{key}?legal-hold&versionId={id}

ON or OFF, versionId required

GetObjectLegalHold

GET /{bucket}/{key}?legal-hold&versionId={id}

versionId required

DeleteObject

DELETE /{bucket}/{key}?versionId={id}

Locked versions: AccessDenied

Operations in detail

PutObjectLockConfiguration

Sets or changes the default retention of a bucket with Object Lock enabled. chili then locks every newly written object version automatically for the given period.

PUT /my-worm-bucket?object-lock HTTP/1.1
Host: s3-ch-east.chilistorage.com
Content-MD5: <Base64 MD5 of the body>
  • Content-MD5 is required. The AWS CLI and common SDKs calculate the header themselves.
  • ObjectLockEnabled always has the value Enabled.
  • DefaultRetention contains Mode and either Days or Years, not both.
  • Without Rule there is no default retention. The application then sets the period per object version, which is what Veeam expects.
<ObjectLockConfiguration>
  <ObjectLockEnabled>Enabled</ObjectLockEnabled>
  <Rule>
    <DefaultRetention>
      <Mode>GOVERNANCE</Mode>
      <Days>30</Days>
    </DefaultRetention>
  </Rule>
</ObjectLockConfiguration>
aws s3api put-object-lock-configuration \
  --bucket my-worm-bucket \
  --object-lock-configuration '{"ObjectLockEnabled":"Enabled","Rule":{"DefaultRetention":{"Mode":"GOVERNANCE","Days":30}}}' \
  --endpoint-url https://s3-ch-east.chilistorage.com

The default retention applies only to new object versions. Versions already stored keep their existing period.

GetObjectLockConfiguration

Reads the Object Lock configuration of a bucket.

GET /my-worm-bucket?object-lock HTTP/1.1
Host: s3-ch-east.chilistorage.com
<ObjectLockConfiguration>
  <ObjectLockEnabled>Enabled</ObjectLockEnabled>
  <Rule>
    <DefaultRetention>
      <Mode>GOVERNANCE</Mode>
      <Days>30</Days>
    </DefaultRetention>
  </Rule>
</ObjectLockConfiguration>
aws s3api get-object-lock-configuration \
  --bucket my-worm-bucket \
  --endpoint-url https://s3-ch-east.chilistorage.com

If the bucket has no Object Lock configuration, chili responds with ObjectLockConfigurationNotFoundError.

PutObjectRetention

Sets mode and expiry date for a single object version. This is how backup software such as Veeam works.

PUT /my-worm-bucket/report.pdf?retention&versionId=<VERSION_ID> HTTP/1.1
Host: s3-ch-east.chilistorage.com
  • versionId is required on chili. You get the version ID in the PutObject response (header x-amz-version-id) or through ListObjectVersions.
  • RetainUntilDate in ISO 8601 format, for example 2027-12-31T00:00:00Z.
  • You can extend a period at any time. In governance mode, shortening or removing it requires x-amz-bypass-governance-retention: true and the s3:BypassGovernanceRetention permission.
<Retention>
  <Mode>GOVERNANCE</Mode>
  <RetainUntilDate>2027-12-31T00:00:00Z</RetainUntilDate>
</Retention>
aws s3api put-object-retention \
  --bucket my-worm-bucket --key report.pdf \
  --version-id <VERSION_ID> \
  --retention '{"Mode":"GOVERNANCE","RetainUntilDate":"2027-12-31T00:00:00Z"}' \
  --endpoint-url https://s3-ch-east.chilistorage.com

GetObjectRetention

Reads mode and expiry date of an object version.

GET /my-worm-bucket/report.pdf?retention&versionId=<VERSION_ID> HTTP/1.1
Host: s3-ch-east.chilistorage.com
<Retention>
  <Mode>GOVERNANCE</Mode>
  <RetainUntilDate>2027-12-31T00:00:00.000Z</RetainUntilDate>
</Retention>
aws s3api get-object-retention \
  --bucket my-worm-bucket --key report.pdf \
  --version-id <VERSION_ID> \
  --endpoint-url https://s3-ch-east.chilistorage.com

PutObjectLegalHold

Sets or removes a legal hold on an object version. A legal hold has no expiry date and applies independently of any retention period.

PUT /my-worm-bucket/report.pdf?legal-hold&versionId=<VERSION_ID> HTTP/1.1
Host: s3-ch-east.chilistorage.com
  • versionId is required.
  • Status is ON or OFF.
<LegalHold>
  <Status>ON</Status>
</LegalHold>
aws s3api put-object-legal-hold \
  --bucket my-worm-bucket --key report.pdf \
  --version-id <VERSION_ID> --legal-hold Status=ON \
  --endpoint-url https://s3-ch-east.chilistorage.com

GetObjectLegalHold

Reads the legal hold status of an object version.

GET /my-worm-bucket/report.pdf?legal-hold&versionId=<VERSION_ID> HTTP/1.1
Host: s3-ch-east.chilistorage.com
<LegalHold>
  <Status>ON</Status>
</LegalHold>
aws s3api get-object-legal-hold \
  --bucket my-worm-bucket --key report.pdf \
  --version-id <VERSION_ID> \
  --endpoint-url https://s3-ch-east.chilistorage.com

Setting the lock on upload

The S3 standard allows you to pass mode, period and legal hold directly with PutObject:

Header

Value

x-amz-object-lock-mode

GOVERNANCE

x-amz-object-lock-retain-until-date

Date in ISO 8601 format

x-amz-object-lock-legal-hold

ON or OFF

Applications such as Veeam usually set the period after the upload with PutObjectRetention. On chili this is the most reliable approach. If you build your own application, we recommend the same approach or a default retention on the bucket.

Bypassing a governance lock

The header x-amz-bypass-governance-retention: true bypasses a governance lock, for example to delete a version early or to shorten a period. The access keys need the s3:BypassGovernanceRetention permission. The header does not bypass a legal hold.

aws s3api delete-object \
  --bucket my-worm-bucket --key report.pdf \
  --version-id <VERSION_ID> \
  --bypass-governance-retention \
  --endpoint-url https://s3-ch-east.chilistorage.com

Give backup software and applications keys without s3:BypassGovernanceRetention. You assign permissions in the chili Console under IAM & object access.

Deleting locked versions

Request

Result

DeleteObject without versionId

chili sets a delete marker, the locked version is kept

DeleteObject with the versionId of a locked version

AccessDenied (HTTP 403)

DeleteObject with versionId and legal hold ON

AccessDenied (HTTP 403), even with bypass

DeleteObject with versionId, bypass header and permission

Version is deleted (governance mode only)

Lifecycle rules never delete locked versions.

Next