Versioning

7.Versioning

M

In this chapter

We'll meet versioning — a real, optional bucket setting that keeps every past copy of an object instead of replacing it outright, turning an accidental overwrite (like the one that just happened to GreenMart's own product image) from permanent loss into a fully recoverable event.

7–9 min

The Problem in Real Life

A junior developer re-uploads a product image under the exact same key, intending to fix a color issue — and accidentally overwrites the correct, live image with an old, wrong draft. "Can we get the original back?" Mike asks.

Sarah checks the bucket's settings. "That depends entirely on one setting we haven't talked about yet."

M

Someone overwrote the live image by accident. Is the original just... gone?

Mike

One Object, One Copy vs. One Object, Its Whole Real History

Every write becomes a new, recoverable version

With versioning on, writing to an existing key never destroys the previous version — it stays fully intact and retrievable.

A real, honest storage cost

Every version of every object is stored separately — cost scales with how often objects are overwritten, not just how many exist.

Versioning

Versioning is a real, optional bucket setting that keeps every past copy of an object, rather than replacing it outright, every time a new object is written to the same real key — turning an accidental overwrite from permanent data loss into a fully recoverable event.

  • Off by default, and what that actually means. Without versioning enabled, writing a new object to an existing key genuinely replaces the old one outright — the previous real content is gone the instant the new PUT completes, with no way to get it back. This is exactly what happened to GreenMart's own product image: the bucket had no versioning enabled, so the accidental overwrite was real, immediate, and permanent.
  • With versioning on — every write becomes a new, real version. Once enabled, writing to an existing key doesn't replace anything — it creates a brand-new real version of that object, tagged with its own real version ID, while every previous version stays fully intact and individually retrievable. The key alone now points at the latest version by default, but any specific past version remains one real, explicit request away.
  • Delete becomes reversible too — the real delete marker. With versioning on, even "deleting" an object doesn't actually remove its data — it adds a real, special delete marker as the newest version, which makes the object appear gone under an ordinary GET, while every real prior version, including the one right before the delete marker, remains fully intact and recoverable by explicitly requesting it.
  • A real, honest cost worth planning for. Versioning isn't free: every real version of every object is separately, fully stored, which means GreenMart's own storage cost scales with how many times an object is overwritten, not just how many distinct objects exist. This is exactly why versioning is usually paired with a real, deliberate policy — the next chapter's own subject — for eventually cleaning up old versions GreenMart no longer genuinely needs to keep.

GreenMart now has the real, deliberate fix for exactly the kind of accident that just happened: versioning turns an overwrite from a one-way, permanent loss into a fully reversible event, at the real, honest cost of storing every version separately.

Key Takeaway

Versioning keeps every past copy of an object instead of replacing it outright — turning an accidental overwrite or delete from permanent loss into a fully recoverable event, at the real, honest cost of storing every version separately.

Why This Matters

As more of GreenMart's own team gains write access to product images and receipts, accidental overwrites like this one become a real, recurring risk — versioning is the one real, deliberate setting standing between a genuine mistake and permanently lost data.

GreenMart now has a real, deliberate way to protect against accidental overwrites — versioning. But keeping every version forever has a real, honest cost. The next chapter covers exactly how to manage that cost deliberately: lifecycle management.

Next