Skip to main content
Lifecycle policies in Gcore Object Storage automatically delete objects after a configured number of days, following the AWS S3 lifecycle configuration standard.

Lifecycle policy logic

Object deletion is processed around midnight UTC. The table below shows when an object is deleted based on the scenario. The midnight UTC processing window means deletion happens at the next processing cycle after the expiration period ends — not at the exact moment the period expires.

Lifecycle configuration elements

AWS CLI uses a JSON configuration file. The file structure is:

AWS CLI lifecycle management

AWS CLI provides three commands for managing lifecycle policies: put-bucket-lifecycle to apply a policy, get-bucket-lifecycle-configuration to verify it, and delete-bucket-lifecycle to remove it.

Applying a lifecycle policy

1

Create the configuration file

Create a lifecycle.json file with the following content:
To apply the rule to a specific folder, set "Prefix" to the folder name: "Prefix": "deleteme/".
2

Apply the policy

Run the following command from the directory containing lifecycle.json, replacing the placeholder values:
3

Verify the configuration

Run the following command to check the current lifecycle configuration:
The response contains the applied policy as JSON.

Deleting a lifecycle policy

Run the following command to remove the lifecycle policy from the bucket:

Protect objects from deletion with Object Lock

To prevent objects from being deleted or overwritten, use S3 Object Lock. See Protect objects with Object Lock.