Skip to content

versioning-suspended buckets

0

To reduce AWS costs, I suspended versioning on one of our buckets. Now, I want to create a lifecycle rule to delete all non-current versions while retaining only the current ones.

Here’s the rule I set up:

Current version actions Day 0: No actions defined.

Noncurrent versions actions Day 0: Objects become noncurrent. Day 1: Retain 0 of the newest noncurrent versions. Permanently delete all other noncurrent versions.

Is this the correct approach? Will all existing current versions remain untouched?

From what I understand from the documentation, any newly created file will have id=null and will always be the current version. If a file with the same prefix is uploaded, it will be replaced, same as non-versioning buckets.

Thanks!

asked a year ago343 views
1 Answer
3

Yes, your understanding is mostly correct. When versioning is suspended on an S3 bucket, new objects are treated as the current version, and if an object with the same key is uploaded, the new one will overwrite the previous version (similar to how it works in non-versioned buckets). Here's a breakdown of your approach:

Lifecycle Rule Breakdown:

Current version actions Day 0: No actions defined.

This means that all current versions of objects will remain untouched. No actions will be applied to current versions. Noncurrent versions actions Day 0: Objects become noncurrent. Day 1: Retain 0 of the newest noncurrent versions. Permanently delete all other noncurrent versions.

Since your bucket’s versioning is suspended, this part of the rule will delete noncurrent versions. Existing noncurrent versions (those created before suspending versioning) will be deleted according to your rule. After 1 day, all noncurrent versions will be permanently deleted.

Will current versions remain untouched?

Yes, the rule will not affect the current versions of objects. Only noncurrent versions (those that existed before you suspended versioning) will be deleted according to the rule. Any new file uploaded will become the current version and remain unaffected by this rule.

Important Notes:

When versioning is suspended, S3 no longer creates new noncurrent versions, so the rule only applies to noncurrent versions that existed before versioning was suspended. New objects will behave as in a non-versioned bucket, with the latest upload always being the current version and replacing previous uploads.

EXPERT
answered a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago
EXPERT
reviewed a year ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.