Configuring a Lifecycle Rule

This section describes how to define lifecycle rules for a bucket so that the rules can take effect on objects in the bucket.

Procedure

  1. Log in to OBS Console.
  2. In the bucket list, click the target bucket to go to the Summary page.
  3. Click Lifecycle Rule.
  4. Click Create.
  5. In Figure 1, configure a lifecycle rule.

    Configure the basic information.
    • Status

      Select Enable to enable the lifecycle rule.

    • Rule Name

      Identify lifecycle rules. The Rule Name contains a maximum of 255 characters.

    • Policy: Can be set to By prefix or For the entire bucket.
      • By prefix: The objects that have this name prefix will be managed by the lifecycle rule.
      • For the entire bucket: All objects in the bucket will be managed by the lifecycle rule.
    NOTE:
    • When By prefix is selected and the specified prefix and the prefix of an existing lifecycle rule overlap, OBS regards the two rules as one and disables your rule. For example, if a rule with prefix abc exists in the system, another rule whose prefix contains abc cannot be configured.
    • If a lifecycle rule whose Policy is set to By prefix has been configured, you cannot configure a lifecycle rule whose Policy is set to For the entire bucket.
    • If a lifecycle rule whose Policy is set to For the entire bucket has been configured, you cannot configure a lifecycle rule whose Policy is set to By prefix. The Create button becomes unavailable.

    Current version or Historical version:

    • Deleted upon expiration: You can specify the number of days after which objects that have been last updated and meet specified conditions are automatically deleted.
      NOTE:
      • Current version and Historical version are two concepts for Versioning. If Versioning is enabled, uploading objects with the same name to the same path generates different versions. The object uploaded later is called Current version, and the object uploaded earlier is called Historical version.
      • You can configure either, both, or neither of the versions.
    Figure 1 Creating a lifecycle rule

    For example, the following files are stored on OBS on January 7, 2015:

    • log/test1.log
    • log/test2.log
    • doc/example.doc
    • doc/good.txt

    The following files are stored on OBS on January 10, 2015:

    • log/clientlog.log
    • log/serverlog.log
    • doc/work.doc
    • doc/travel.txt

      If the expiration time of objects prefixed with log/ is set to January 11, 2015 on January 10, 2015, OBS will delete objects log/test1.log, log/test2.log, log/clientlog.log, and log/serverlog.log on January 12, 2015.

      If the expiration time of objects prefixed with log/ is set to January 8, 2015 on January 10, 2015, OBS will delete objects log/test1.log and log/test2.log that were last modified before January 8, 2015 on January 10, 2015 but will not delete objects log/clientlog.log and log/serverlog.log that were stored on OBS the same day.

    NOTE:

    The deletion of an object may be delayed after the time condition is met. Generally, the delay does not exceed 48 hours.

  6. Click OK.

    A message is displayed indicating that the lifecycle rule is successfully created.

Follow-up Procedure

You can click Edit or Delete to edit or delete a configured lifecycle rule.

Registration