Versioning and Lifecycle Management with S3

Learn about versioning and lifecycle management with S3.

Versioning

Versioning stores all versions of an object (including all writes even if an object is deleted). It protects against accidental object/data deletion or overwrites and enables “roll-back” and “un-delete” capabilities.

Enabling versioning does not replicate existing objects, but it can be used for backup. It can also be used for data retention and archive. Versioning can be integrated with lifecycle rules.

Watch out!

Once enabled, versioning cannot be disabled, only suspended.

Deletion

Multi-factor authentication (MFA) delete can be enabled. MFA delete can also be applied to changing versioning settings.

MFA delete applies to:

  • Changing the bucket’s versioning state.
  • Permanently deleting an object.

Only the S3 bucket owner can permanently delete objects once versioning is enabled. When you try to delete an object with versioning enabled, a DELETE marker is placed on the object. You can delete the DELETE marker, and the object will be available again. Deletion with versioning replicates the delete marker. But deleting the delete marker is not replicated.

Billing

Old versions count as billable size until they are permanently deleted.

Replication

Cross-Region Replication requires versioning to be enabled on the source and destination buckets. By default, an HTTP GET retrieves the most recent version.

Reverting to previous versions isn’t replicated.

Bucket versioning states are:

  • Enabled
  • Versioned
  • Un-versioned

Objects that existed before enabling versioning will have a version ID of NULL.

Suspension

  • If you suspend versioning, the existing objects remain as they are; however, new versions will not be created.
  • While versioning is suspended, new objects will have a version ID of NULL, and uploaded objects of the same name will overwrite the existing object.

Level up your interview prep. Join Educative to access 80+ hands-on prep courses.