You can configure the lifecycle rule for a bucket or an object. You can transition the storage class of an object from Standard to Warm or Cold, or from Warm to Cold. However, an object in the Cold storage class cannot be transitioned to other storage classes by configuring the lifecycle rule.
- In the bucket list on the OBS Console, click the target bucket to go to the Summary page.
- Click Lifecycle Rules.
- Click Create. A dialog box is displayed in Figure 1.
Figure 1 Creating a lifecycle rule
- Configure a lifecycle rule.
Configure the basic information.
- Object name prefix cannot start or end with a slash (/), have two consecutive slashes (/), or contain the following special characters: \:*?"<>|
- When Object name 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 starts with abc cannot be configured.
- If a lifecycle rule whose Applies To is set to Object name prefix has been configured, you cannot configure a lifecycle rule whose Applies To is set to Bucket.
- If a lifecycle rule whose Applies To is set to Bucket has been configured, you cannot configure a lifecycle rule whose Applies To is set to Object name prefix.
Current Version or Historical Version:
- Transition to Warm: You can specify the number of days after which objects that have been last updated and meet specified conditions are automatically transitioned to Warm. This number must be at least 30.
- Transition to Cold: You can specify the number of days after which objects that have been last updated and meet specified conditions are automatically transitioned to Cold. If objects are configured to be transitioned to both Warm and Cold, the number of days for transition to Cold must be at least 30 days later than that for transition to Warm. If only transition to Cold is enabled and transition to Warm is disabled, there is no limit on the number of days for transition.
- Expiration Time: You can specify the number of days after which objects that have been last updated and meet specified conditions are automatically deleted. The expiration time must be greater than the two transition times.
- 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.
For example, the following files are stored on OBS on January 7, 2015:
The following files are stored on OBS on January 10, 2015:
If objects prefixed with log is set to expire in 1 Day 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.
On the day of operation, you can set the objects with the name prefix log to be transitioned to Warm 30 days later, transitioned to Cold 60 days later, and deleted 100 days later. Then OBS will transition log/clientlog.log, log/serverlog.log, log/test1.log, and log/test2.log to Warm on the 31st day, transition them to Cold the 61st day, and delete them on the 101st day, respectively.
The storage class transition and deletion of an object may be delayed after the time condition is met. Generally, the delay does not exceed 48 hours.
- Click OK.