You can configure lifecycle rules to convert the storage classes of multiple objects in a bucket and delete multiple specified objects and parts.

Background information

  • After a lifecycle rule is configured, it is loaded within 24 hours, and is run within 24 hours after it is loaded. Check the rule configurations before you save it.
  • The delete operation is irreversible. Configure lifecycle rules as needed.
  • You can configure up to 100 lifecycle rules in the console. To configure more rules, use ossutil or SDKs. For more information, see Manage object lifecycle.

Procedure

  1. Log on to the OSS console.
  2. Click the target bucket and find the Lifecycle section.
    • New console
      1. Click Buckets, and then click the name of the target bucket.
      2. Choose Basic Settings > Lifecycle.
    • Old console
      1. In the left-side navigation pane, click the name of the target bucket.
      2. Click the Basic Settings tab. Find the Lifecycle section.
  3. Click Configure.
  4. Click Create Rule. In the Create Rule dialog box that appears, configure the following parameters.
    • Versioning is not enabled for the bucket
      Parameter Description
      Basic Settings
      Status Specify the status of the lifecycle rule. Valid values: Enabled and Disabled.
      Applied To Select policies used to match objects. You can select Files with Specified Prefix or Whole Bucket. Files with Specified Prefix indicates that this rule is applicable to objects whose names contain a specified prefix. Whole Bucket indicates that this rule is applicable to all objects in the bucket.
      Note If you select Files with Specified Prefix, you can configure multiple lifecycle rules for objects whose names contain different prefixes. If you select Whole Bucket, only one lifecycle rule can be configured.
      Prefix If you set Applied To to Files with Specified Prefix, you must specify the name prefix of the objects to which the rule applies. For example, if you want to match objects whose names start with img, enter img.
      Tagging Select the check box and configure tags. The rule is applicable to only objects that have the specified tags. Example: Select Files with Specified Prefix and set Prefix to img, Key to a, and Value to 1. The rule is applicable to all objects whose names start with img and whose tagging configurations are a=1. For more information about object tagging, see Configure object tagging.
      Clear Policy
      File Lifecycle Select policies according to which objects expire. You can set File Lifecycle to Validity Period (Days), Expiration Date, or Disabled. If you select Disabled, File Lifecycle does not take effect.
      Transit to IA Storage Class Specify when objects expire based on Validity Period (Days) or Expiration Date that you set for the File Lifecycle. The storage class of the objects is converted to IA after they expire.
      • Validity Period (Days): specifies the number of days within which objects can be retained after they are last modified. After they expire, the storage class of the objects is converted to IA. For example, if you set Validity Period (Days) to 30, the storage class of the objects that are last modified on January 1, 2019 is converted to IA on February 1, 2019.
      • Expiration Date: specifies a date on which all objects that are last modified before this date expire and the storage class of these objects is converted to IA. For example, if you set Expiration Date to 2019-1-1, the storage class of objects that are last modified before January 1, 2019 is converted to IA.
      Note
      • You can only convert the storage class of standard objects to IA based on the lifecycle rules.
      • For more information about the pricing after storage classes of objects are converted, see Manage lifecycle rules.
      Transit to Archive Storage Class Specify when objects expire based on Validity Period (Days) or Expiration Date that you set for the File Lifecycle.The storage class of the objects is converted to Archive after they expire. The configuration method is the same as that for Transit to IA Storage Class.
      Delete Specify when objects expire based on Validity Period (Days) or Expiration Date that you set for the File Lifecycle.The objects are deleted after they expire. The configuration method is the same as that for Transit to IA Storage Class.
      Delete Parts
      Part Lifecycle Specify the operations to perform on expired parts. You can set Part Lifecycle to Validity Period (Days), Expiration Date, or Disabled. If you select Disabled, Part Lifecycle does not take effect.
      Notice
      • Configure at least either of File Lifecycle and Part Lifecycle.
      • If you select Tagging, Part Lifecycle is unavailable.
      Delete Specify when parts expire based on Validity Period (Days) or Expiration Date that you set for Part Lifecycle. The parts are deleted after they expire. The configuration method is the same as that for Transit to IA Storage Class.
    • Versioning is enabled for the bucket

      After versioning is enabled for a bucket, you can manage previous versions of objects in the bucket. For more information about versioning, see Introduction to versioning.

      When versioning is enabled, lifecycle rules that are configured when versioning is disabled apply to the current object version. The following table describes the operations to perform on previous versions.

      Parameter Description
      Previous Versions
      File Lifecycle Select policies according to which previous versions expire. You can set File Lifecycle to Validity Period (Days) or Disabled. If you select Disabled, File Lifecycle does not take effect.
      Transit to IA Storage Class Specify the number of days within which objects can be retained after they become previous versions. After they expire, the storage class of the previous versions is converted to IA. For example, if you set Validity Period (Days) to 30, the storage class of the objects that become previous versions on January 1, 2019 is converted to IA on February 1, 2019.
      Note
      • You can only convert the storage class of standard objects to IA based on the lifecycle rules.
      • You can determine the time when an object becomes a previous version based on the date the later version is last modified.
      Transit to Archive Storage Class Specify the number of days within which objects can be retained after they become previous versions. After they expire, the storage class of the previous versions is converted to Archive. The configuration method is the same as that for Transit to IA Storage Class.
      Delete Specify the number of days within which objects can be retained after they become previous versions. After they expire, the previous versions are deleted. The configuration method is the same as that for Transit to IA Storage Class.
      Note The delete operation on previous versions is also applicable to delete markers.
      Clean up Delete Marker This configuration is applicable to buckets for which versioning is enabled or suspended. If the current object version is the only version that serves as the delete marker, OSS deletes the delete marker.
      Notice
      • If you select Clean up Delete Marker, you must set Current Version to Disabled. In this case, Tagging is unavailable.
      • For more information about delete markers, see Delete marker.
  5. Click OK.
  6. After the lifecycle rule is saved, you can view the rule in the list of lifecycle rules. You can also click Edit or Delete in the Actions column corresponding to a lifecycle rule to edit or delete the rule.