All Documents
Current Document

Content is empty

If you don't find the content you expect, please try another search term

Documentation

Lifecycle

Last updated:2021-09-14 16:17:51

KS3 allows you to delete multiple objects at a time or change their storage classes at a specified point in time or after a specified period of time after the objects are last modified. You can implement this feature by create lifecycle rules for a bucket.

To create a lifecycle rule, perform the following steps:

  1. Select the bucket for which you want to manage the lifecycle.
  2. Configure a lifecycle rule. The lifecycle rule can apply to the entire bucket or objects with the specified prefix.
  3. Specify the policy. You can specify an expiration date or a period of time. The objects that match the rule are deleted or their storage classes are changed on the specified date or after the specified period of time after they are last modified.

After lifecycle rules are created, you can enable or disable them.

You can create a maximum of 1,000 rules for each bucket.

For objects that were uploaded before April 12, 2017, you cannot delete them or change the storage classes for them.

Usage notes

Status

The status of a rule indicates whether the rule is enabled or disabled.

Policy

The policy of a rule specifies the objects that match the rule. KS3 supports the following rule matching methods:

  • Matching by prefix

    • A rule matches objects with the specified prefix. You can create multiple rules to match different prefixes. The prefixes of different rules cannot overlap. For example, if you configure two rules in which one rule matches pics/ and the other rule matches pics/program for the same bucket, KS3 returns an error.
    • If you have created a rule that applies to all objects, you cannot create a rule that matches a specific prefix.
    • Do not start a prefix with a forward slash (/). Such a prefix does not match any object.
    • A rule that applies to a bucket also applies to all objects in the bucket. A prefix-based rule applies only to objects with the specified prefix.
  • Matching by tag

    • A rule matches objects with the specified tags, including both the keys and values.
    • You can specify multiple tags for a rule. The rule matches objects with all the specified tags.

    • Matching by prefix and tag: A rule match objects with the specified prefix and one or more tags.

    • Bucket-wide application: A rule matches all objects and parts in the bucket. You can create only one rule that applies to the entire bucket.

For example, a bucket contains the following objects:

pics/dog.gif
pics/cat.gif
pics/bird.gif
docs/readme.txt

If the prefix pics/ is specified for a rule, the rule applies to the first three objects whose names start with pics/. If the prefix docs/readme.txt is specified for a rule, the rule applies only to the object docs/readme.txt.

Expiration policy

You can specify an expiration period in days or an expiration date.

  • If you specify an expiration period, the matching objects are deleted or their storage classes are changed after the specified number of days after the objects are last modified.

    For example, you can create a rule that applies to all objects to delete objects three days after they are last modified. If Object 1 is last modified at 2018-08-01 18:01:26, it is deleted three days later at 2018-08-05 00:00:00. If Object 2 is last modified at 2018-08-03 18:01:26, it is deleted three days later at 2018-08-07 00:00:00.

  • If you specify an expiration date, the objects whose last modification dates are before the specified date are deleted or their storage classes are changed.

    For example, you can create a rule to change the storage classes of matching objects to IA and specify the expiration date 2018-01-01T00:00:00.000Z for the rule. If Object 1 is last modified at 2017-08-01 18:01:26, its storage class is changed to IA. If Object 2 is last modified at 2018-08-02 18:01:26, its storage class is not changed.

Rule execution

Change the storage class to IA

You can specify an expiration period or an expiration date for a rule or disable the rule. If you enable a rule, it takes effect within one day. For example, if you enable a rule at 03:00 pm, the rule takes effect at 00:00 the next day. After the conditions are met and the action is triggered, it takes a period of time for KS3 to change the storage class. This period of time is related to the number of objects.

Change the storage class to Archive

You can specify an expiration period or an expiration date for a rule or disable the rule. If you enable a rule, it takes effect within one day. For example, if you enable a rule at 03:00 pm, the rule takes effect at 00:00 the next day. After the conditions are met and the action is triggered, it takes a period of time for KS3 to change the storage class. This period of time is related to the number of objects.

Delete an object upon expiration

If you enable a rule, it takes effect within one day. For example, if you enable a rule at 03:00 pm, the rule takes effect at 00:00 the next day. After the conditions are met and the action is triggered, it takes a period of time for KS3 to delete the objects. This period of time is related to the number of objects.

Limits

  • If a rule for changing the storage class to IA and a rule for changing the storage class to Archive are configured at the same time, the following limit applies: The expiration period or date for changing the storage class to IA + 30 <= The expiration period or date for changing the storage class to Archive.
  • If a rule for changing the storage class to IA and a rule for deleting objects are configured at the same time, the following limit applies: The expiration period or date for changing the storage class to IA < The expiration period or date for deleting objects.
  • If a rule for changing the storage class to Archive and a rule for deleting objects are configured at the same time, the following limit applies: The expiration period or date for changing the storage class to Archive < The expiration period or date for deleting objects.
  • If a rule for changing the storage class to IA, a rule for changing the storage class to Archive, and a rule for deleting objects are configured at the same time, the following limit applies: The expiration period or date for changing the storage class to IA + 30 <= The expiration period or date for changing the storage class to Archive < The expiration period or date for deleting objects.
  • No limit is applicable if only one of the three rules is configured.

Pricing for changing the storage class

  • The minimum storage duration of IA objects is 30 days. If an IA object is deleted or its storage class is changed within 30 days, the storage fees for the object are charged as it is stored for 30 days, including the remaining duration. If the storage duration exceeds 30 days, no additional fees are charged.
  • The minimum storage duration of Archive objects is 90 days. If an Archive object is deleted or its storage class is changed within 90 days, the storage fees for the object are charged as it is stored for 90 days, including the remaining duration. If the storage duration exceeds 90 days, no additional fees are charged.

Matching logic of lifecycle rules

  • Effect of prefix-based rules A prefix-based rule applies to an object as long as the name of the object matches the specified prefix. For example, a bucket contains the following objects:

    • logs/program.log.1
    • logs/program.log.2
    • logs/program.log.3
    • doc/readme.txt

    If the prefix logs/ is specified for a rule, the rule applies to the first three objects whose names start with logs/. If the prefix docs/readme.txt is specified for a rule, the rule applies only to the object docs/readme.txt.

  • Conflicting rules If an object matches multiple rules with different actions at the same time, KS3 executes the actions in the following order: Delete the object > Change the storage class to Archive > Change the storage class to IA. Example Assume that you have configured the following rules.

    Rule No. Prefix Tag Action
    Rule 1 123 a=1 Delete a matching object 20 days after the object is last modified.
    Rule 2 12345 a=1 Change the storage class of a matching object to Archive 20 days after the object is last modified.
    Rule 3 1233456 a=1 Change the storage class of a matching object to IA 20 days after the object is last modified.

    Objects that match the prefix 123 and has the tag a=1 are deleted 20 days after they are last modified based on Rule 1. After the objects are deleted, no objects match Rule 2 or Rule 3, which are therefore meaningless.

On this page
Pure ModeNormal Mode

Pure Mode

Click to preview the document content in full screen
Feedback