Skip to navigation

Lifecycle Management

A lifecycle rule is an instruction on a bucket that deletes objects automatically when they reach a certain age or date. Use it so old logs, temporary exports or expired backups don’t pile up and keep costing money. A rule can cover the whole bucket or only keys that start with a prefix, such as logs/.

When to use a lifecycle rule

You want to…Use
Delete files a fixed number of days after upload (logs, temp files, old backups)A rule with Expire after → Days
Delete everything under a prefix on one date (end of a campaign or project)A rule with Expire after → Date
Delete one file nowDelete it in the portal or with aws s3 rm — see Objects
Empty the whole bucket nowEmpty bucket — see Buckets
Stop files from being deletedObject Lock

How it works

  1. You add a rule with a prefix (or none, for every object) and an expiry: a number of days after upload, or a date.
  2. The storage system checks objects in the background and deletes the ones that match once they are past the expiry.
  3. Deleted objects stop being counted for storage from the next billing month. See Pricing.

Before you begin

  • A bucket. See Create a bucket.
  • Write access to the bucket’s settings in the portal, or a platform API token with object-storage.write.
  • Know the prefix: keys are case-sensitive, so Logs/ and logs/ are different.

Objects removed by a lifecycle rule are deleted permanently (unless the bucket has versioning through Object Lock). Test a new rule on a narrow prefix first.

Add a rule in the portal

1

Open Lifecycle Policies

Open the bucket, click Settings, then Lifecycle Policies. A bucket without rules shows No lifecycle rules.

2

Add a rule

Click Add Rule. The Lifecycle rules panel opens.

3

Set the filter and status

FieldWhat to enter
Prefix filterFor example logs/. Leave it empty to apply the rule to every object in the bucket.
Rule statusEnabled to run the rule. A disabled rule is saved but does nothing.
4

Choose the expiry

Under Lifecycle actions, tick Expire after, then choose Days (for example 30) or Date. At least one action must be ticked: Select at least one action before applying changes.

Incomplete uploads and Transition after also appear in the form, but the storage service doesn’t apply them yet.

5

Apply

Click Apply changes. The rule appears as a card with a summary of its actions.

Add a rule with the API

PUT replaces all the bucket’s rules with the list you send, so include every rule you want to keep. Each rule needs status and either expiration_days (1 or more) or expiration_date, not both.

curl -X PUT "https://api.ibee.ai/v1/object-storage/buckets/my-bucket/lifecycle?workspace_id=YOUR-WORKSPACE-ID" \
-H "Authorization: Bearer $IBEE_API_TOKEN" \
-H "Content-Type: application/json" \
-d '{"rules": [{"status": "Enabled", "prefix": "logs/", "expiration_days": 30}]}'

GET on the same path returns the rules; DELETE removes all of them and needs object-storage.delete. The S3 call PutBucketLifecycleConfiguration returns 501 on the S3 endpoint; use these operations.

Verify

  • The rule card shows the prefix, Enabled and Expire after 30 days (or your date).
  • GET …/lifecycle returns your rule.
  • To test, add a rule with Expire after → 1 day on a test prefix, upload a file there, and check the next day or later that it’s gone.

Manage rules

  • Edit: click the rule card, change the fields, click Apply changes.
  • Turn off: use the toggle on the card. The rule stays saved.
  • Delete: click the delete icon, then Delete in the Delete lifecycle rule dialog.

Limits and timing

Value
Expiry in daysA whole number, 1 or more, counted from each object’s upload. The portal suggests 30 days.
Expiry on a dateObjects matching the rule are deleted on or after that date
Days and date in one ruleNot allowed: one or the other
Actions applied todayExpire after only
When deletion happensIn the background, some time after an object becomes eligible — not at an exact minute. A rule of 1 day doesn’t delete an object 24 hours to the second after upload.
Objects under Object LockNot deleted while their retention or legal hold lasts

Troubleshooting

You seeWhat it meansWhat to do
Apply changes is disabled, with Select at least one action before applying changes.No action is tickedTick Expire after.
Objects aren’t deletedThe rule is disabled, the prefix doesn’t match (case or missing /), or the objects aren’t old enough yetCheck Rule status, the exact prefix, and the upload dates. Allow time for the background check.
Objects outside the “folder” were deletedPrefix filter was empty, so the rule applied to the whole bucketSet a prefix, such as logs/.
Locked objects stay after expiryObject Lock retention or legal hold protects themThey’re deleted only after the lock ends.
API: Either expiration_days or expiration_date must be specified. or Cannot specify both expiration_days and expiration_date.The rule body is wrongSend exactly one of the two.
Old multipart uploads aren’t cleaned upIncomplete uploads isn’t applied yetAbort them with aws s3api abort-multipart-upload.