Reputation: 7986
The docs only mention setting an object lifecycle for an entire bucket. However I want to set lifecycles for several paths within a bucket, but not for the entire bucket.
Is this possible on Google Cloud Storage? If so, how can I do it?
Upvotes: 8
Views: 2713
Reputation: 553
If I understand your question correctly, what you want to achieve is having a lifecycle rule restricted to only certain subpaths. You can achieve this by setting Conditions on the rule.
Object lifecycle rules can combine multiple conditions. If you want a certain lifecycle to be applied only to a specific sub-path of the bucket, you can combine the condition you want to apply to that sub-path the condition matches prefix.
For example, if you want to set the object storage class to Nearline only for objects in the sub-path goToNearline/
, you can achive this by creating a lifecycle rule like the following:
Yes, the lifecycle rule is still applied to the bucket-level, but the condition restricts its application, so this is virtually equivalent to having it set only for a specific sub-path.
Upvotes: 0
Reputation: 12145
It's not possible to configure lifecycle management for less than an entire bucket.
Upvotes: 7