Design object storage keys for a growing media library

Abstract media systems diagram for Design object storage keys for a growing media library

A naming scheme that supports ownership, versions, cleanup, and migration.

Use opaque identities

An object key is an address, not a database record or a trustworthy filename. Use an asset ID and a stable prefix such as originals/{asset-id}/source. Keep the user’s filename, title, and owner in application metadata. This avoids collisions and makes renaming an asset independent of moving bytes.

Separate source from derivatives

Put generated files under a versioned recipe prefix, for example derivatives/{asset-id}/{recipe-version}/. A new crop rule or encoder can then coexist with the old output during rollout. Record each derivative’s key, dimensions, format, and status so the application never guesses what exists.

Plan deletion as a workflow

Removing an asset requires more than deleting one URL. Mark it unavailable, revoke public references, enqueue deletion of source and derivative keys, and confirm completion. Inventory and lifecycle rules help find abandoned uploads, but do not replace an application-level deletion record.

A concrete acceptance test

Rename an asset, regenerate one derivative, and delete the asset. Confirm that the opaque source key remains stable through renaming and that deletion removes every recorded derivative. Run this test with a realistic asset and record the observed state, output URL, and failure reason.

Implementation check

  • Use an opaque asset ID instead of the original filename.
  • Version derivative prefixes separately from source keys.
  • Track every key that deletion must remove.

Related guides

Primary reference: Official documentation.