Lifecycle

Last updated:2021-04-28 11:04:11

In Kingsoft Cloud Standard Storage Service (KS3), you can delete multiple objects or change the storage class of multiple objects in batches at a specified point in time or a specified period after the objects are last modified. To implement this feature, configure lifecycle rules for the corresponding bucket.

To configure a lifecycle rule, you must select one bucket. You can configure a lifecycle rule that applies to the whole bucket or objects with a specified prefix in the bucket. You can then configure a policy and specify an expiration time or a validity period (days) to delete objects or change the storage class of objects at a specified point in time or a specified period after the objects are last modified.

After you configure a lifecycle rule, you can enable or disable it.

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

For objects that were uploaded before April 12, 2017, you cannot configure lifecycle rules to change the storage class for them or delete them upon expiration. Requests that asynchronously trigger lifecycle rules are recorded in bucket logs and incur related request fees.

  • For more information about how to configure lifecycle rules in the console, see Life Cycle Management.

  • For more information about the API operation used to create a lifecycle rule, see Put Bucket Lifecycle.

Description

- Status:

Specify the status of the lifecycle rule. You can enable or disable the rule.

- Policy:

Matching range: KS3 supports the following matching methods:

  • Match by prefix:

    • You can match objects by a specified prefix. You can configure multiple rules to specify different prefixes. The prefixes specified by different rules cannot overlap. If a bucket has two rules that specify prefixes pics/ and pics/program, KS3 returns an error.
    • All objects and objects with any prefix are overlapped. If you have configured a rule that applies to all objects in a bucket, you cannot configure a rule to specify a prefix.
    • Do not specify a prefix that starts with a forward slash (/). Otherwise, no object can be matched.
    • A rule that applies to the whole bucket indicates that this rule applies to all objects in the bucket. A rule that specifies a prefix indicates that this rule applies to objects with this specified prefix.
  • Match by tag:

    • You can match objects by a tag key and tag value.
    • You can configure multiple tags in a single rule. KS3 runs the lifecycle rule for all objects that have these tags.
  • Match by prefix and tag:
    You can match objects by specifying a prefix and one or more tags.

  • Match by bucket:
    You can match all objects and parts contained in the bucket. You can configure only one rule if you select this method.

For example, a bucket contains the following objects:

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

If the prefix specified by a rule is pics/, the rule applies to the first three objects that are prefixed with pics/. If the prefix specified by a rule is docs/readme.txt, the rule applies only to the docs/readme.txt object.

- Lifecycle policy

You can specify a validity period or expiration time.

  • If you specify a validity period in a lifecycle policy, KS3 deletes objects or changes the storage class of objects after a specified period from the day when the objects are last modified.

    For example, if you set the validity period to 3, object 1, which is last modified at 18:01:26 on August 1, 2018, is deleted at 00:00:00 on August 5, 2018. Object 2, which is last modified at 18:01:26 on August 3, 2018, is deleted at 00:00:00 on August 7, 2018.

  • If you specify an expiration time in a lifecycle policy, KS3 deletes objects or changes the storage class of objects that are last modified before this time. For example, if you set the expiration time to 00:00:00 on January 1, 2018 and set the action to Convert to Low Frequency Storage, object 1, which is last modified at 18:01:26 on August 1, 2017, is converted to low frequency storage. Object 2, which is last modified at 18:01:26 on August 2, 2018, is not converted to low frequency storage.

Action

- Convert to low frequency storage

You can enable or disable the validity period or expiration time. If you enable the validity period or expiration time, the rule takes effect in one day. For example, the rule enabled at 15:00 takes effect at 00:00 the next day. KS3 takes a period of time to complete the conversion. This period of time depends on the number of objects to be converted.

- Convert to archive storage

You can enable or disable the validity period or expiration time. If you enable the validity period or expiration time, the rule takes effect in one day. For example, the rule enabled at 15:00 takes effect at 00:00 the next day. KS3 takes a period of time to complete the conversion. This period of time depends on the number of objects to be converted.

- Delete

The rule takes effect in one day. For example, the rule enabled at 15:00 takes effect at 00:00 the next day. KS3 takes a period of time to complete the deletion. This period of time depends on the number of objects to be deleted.

- Limits

  • If you configure a rule to convert the storage class to Low Frequency and a rule to convert the storage class to Archive, the validity period or expiration time for converting the storage class to Archive must be at least 30 days longer than that for converting the storage class to Low Frequency.
  • If you configure a rule to convert the storage class to Low Frequency and a rule to delete the objects, the validity period or expiration time for deleting the objects must be longer than that for converting the storage class to Low Frequency.
  • If you configure a rule to convert the storage class to Archive and a rule to delete the objects, the validity period or expiration time for deleting the objects must be longer than that for converting the storage class to Archive.
  • If you configure a rule to convert the storage class to Low Frequency, a rule to convert the storage class to Archive, and a rule to delete the objects, the validity period or expiration time for deleting the objects must be longer than that for converting the storage class to Archive. Additionally, the validity period or expiration time for converting the storage class to Archive must be at least 30 days longer than that for converting the storage class to Low Frequency.
  • No limit applies if you configure only one of the preceding rules.

- Fees for converting the storage class

  • The minimum storage period for low frequency storage is 30 days. For objects deleted or converted in less than 30 days, the storage fee for the remaining days must be paid. No extra fees are charged for the storage of more than 30 days.
  • The minimum storage period for archive storage is 90 days. For objects deleted or converted in less than 90 days, the storage fee for the remaining days must be paid. No extra fees are charged for the storage of more than 90 days.

- Matching logic of lifecycle rules

  • Prefix matching rule
    A rule applies to an object if the prefix of the object name matches the prefix specified in the rule. 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 specified by a rule is logs/, the rule applies to the first three objects that are prefixed with logs/. If the prefix specified by a rule is doc/readme.txt, the rule applies only to the doc/readme.txt object.
  • Matching conflicts
    If objects match two or more rules at the same time, a rule to delete objects takes precedence over a rule to convert the storage class to Archive. In addition, a rule to convert the storage class to Archive takes precedence over a rule to convert the storage class to Low Frequency. Example:
Rule Prefix Tag Action
rule1 123 a=1 Delete objects 20 days after they are last modified.
rule2 12345 a=1 Convert the storage class of objects to Archive 20 days after they are last modified.
rule3 1233456 a=1 Convert the storage class of objects to Low Frequency 20 days after they are last modified.

All objects whose names are prefixed with 123 and for which tagging configurations are a=1 are deleted 20 days after they are last modified. In this case, objects have been deleted and rule2 and rule3 make no sense.

Did you find the above information helpful?

Unhelpful
Mostly Unhelpful
A little helpful
Helpful
Very helpful

What might be the problems?

  • Insufficient
  • Outdated
  • Unclear or awkward
  • Redundant or clumsy
  • Lack of context for the complex system or functionality

More suggestions

0/200

Please give us your feedback.

Submitted

Thank you for your feedback.

问题反馈