Docs

Lifecycle and tagging

With lifecycle rules, chili automatically deletes objects, old versions and incomplete multipart uploads after a set time. With tags you attach key-value pairs to individual object versions, for example to apply lifecycle rules selectively.

chili is hot storage only. There are no storage classes and therefore no transition rules. On chili, lifecycle rules are used only for deletion. All examples use path style and the endpoint https://s3-ch-east.chilistorage.com.

Operations

Operation

Method and path

Notes

PutBucketLifecycleConfiguration

PUT /{bucket}?lifecycle

Replaces all rules, Content-MD5 required

GetBucketLifecycleConfiguration

GET /{bucket}?lifecycle

Read the rules

DeleteBucketLifecycle

DELETE /{bucket}?lifecycle

Remove all rules

PutObjectTagging

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

Replaces all tags of the version

GetObjectTagging

GET /{bucket}/{key}?tagging

Optional versionId

DeleteObjectTagging

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

Removes all tags of the version

Lifecycle rules

Take care with buckets for backup software: programs such as Veeam manage retention and deletion themselves. A lifecycle rule can remove data the software still needs and break backup chains. Do not set lifecycle rules on Veeam buckets.

Lifecycle rules never delete versions locked by Object Lock. A rule only takes effect once the lock has expired.

Supported elements

Element

Effect

ID

Rule name, at most 255 characters

Status

Enabled or Disabled

Filter with Prefix

Rule applies to keys with this prefix

Filter with Tag

Rule applies to objects with this tag

Filter with And

Prefix and several tags combined

Expiration with Days or Date

Current version expires after a number of days or on a date

Expiration with ExpiredObjectDeleteMarker

Removes delete markers that no longer have versions behind them

NoncurrentVersionExpiration with NoncurrentDays

Deletes older versions after the given number of days

AbortIncompleteMultipartUpload with DaysAfterInitiation

Aborts incomplete multipart uploads

In a versioned bucket, Expiration does not delete the current version permanently. chili sets a delete marker and the version becomes an older version. It is only deleted permanently by NoncurrentVersionExpiration.

PutBucketLifecycleConfiguration

Sets the lifecycle configuration of a bucket. Existing rules are replaced completely. To add a rule, read the current configuration first and send all rules together.

PUT /my-bucket?lifecycle HTTP/1.1
Host: s3-ch-east.chilistorage.com
Content-MD5: <Base64 MD5 of the body>

Example: expire logs under logs/ after 90 days, delete older versions after 30 days and clean up aborted uploads after 7 days.

<LifecycleConfiguration>
  <Rule>
    <ID>logs-90-days</ID>
    <Filter>
      <Prefix>logs/</Prefix>
    </Filter>
    <Status>Enabled</Status>
    <Expiration>
      <Days>90</Days>
    </Expiration>
    <NoncurrentVersionExpiration>
      <NoncurrentDays>30</NoncurrentDays>
    </NoncurrentVersionExpiration>
  </Rule>
  <Rule>
    <ID>clean-up-uploads</ID>
    <Filter>
      <Prefix></Prefix>
    </Filter>
    <Status>Enabled</Status>
    <AbortIncompleteMultipartUpload>
      <DaysAfterInitiation>7</DaysAfterInitiation>
    </AbortIncompleteMultipartUpload>
  </Rule>
</LifecycleConfiguration>

The same configuration as JSON for the AWS CLI (lifecycle.json):

{
  "Rules": [
    {
      "ID": "logs-90-days",
      "Filter": { "Prefix": "logs/" },
      "Status": "Enabled",
      "Expiration": { "Days": 90 },
      "NoncurrentVersionExpiration": { "NoncurrentDays": 30 }
    },
    {
      "ID": "clean-up-uploads",
      "Filter": { "Prefix": "" },
      "Status": "Enabled",
      "AbortIncompleteMultipartUpload": { "DaysAfterInitiation": 7 }
    }
  ]
}
aws s3api put-bucket-lifecycle-configuration \
  --bucket my-bucket \
  --lifecycle-configuration file://lifecycle.json \
  --endpoint-url https://s3-ch-east.chilistorage.com

If an expiration rule applies to an object, the PutObject response contains the x-amz-expiration header with the expiry date and rule ID.

GetBucketLifecycleConfiguration

aws s3api get-bucket-lifecycle-configuration \
  --bucket my-bucket \
  --endpoint-url https://s3-ch-east.chilistorage.com

If the bucket has no rules, chili responds with NoSuchLifecycleConfiguration.

DeleteBucketLifecycle

Removes all lifecycle rules of the bucket. Data that has already been deleted does not come back.

aws s3api delete-bucket-lifecycle \
  --bucket my-bucket \
  --endpoint-url https://s3-ch-east.chilistorage.com

Object tagging

Tags are key-value pairs on an object version. They work as filters for lifecycle rules and help organise data. The S3 standard allows up to 10 tags per object.

Pass the version ID with PutObjectTagging and DeleteObjectTagging. You get it on upload in the x-amz-version-id header or through ListObjectVersions.

PutObjectTagging

Sets the tags of an object version. Existing tags are replaced completely.

PUT /my-bucket/report.pdf?tagging&versionId=<VERSION_ID> HTTP/1.1
Host: s3-ch-east.chilistorage.com
<Tagging>
  <TagSet>
    <Tag>
      <Key>project</Key>
      <Value>alpha</Value>
    </Tag>
    <Tag>
      <Key>retention</Key>
      <Value>short</Value>
    </Tag>
  </TagSet>
</Tagging>
aws s3api put-object-tagging \
  --bucket my-bucket --key report.pdf \
  --version-id <VERSION_ID> \
  --tagging '{"TagSet":[{"Key":"project","Value":"alpha"},{"Key":"retention","Value":"short"}]}' \
  --endpoint-url https://s3-ch-east.chilistorage.com

GetObjectTagging

Without versionId, chili returns the tags of the current version.

aws s3api get-object-tagging \
  --bucket my-bucket --key report.pdf \
  --endpoint-url https://s3-ch-east.chilistorage.com

DeleteObjectTagging

Removes all tags of an object version.

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

Tags on upload

The S3 standard allows tags to be passed directly with PutObject in the x-amz-tagging header. On chili, the reliable approach is PutObjectTagging after the upload.

Next