An upload to a key that already exists replaces the object. One wrong upload, or one wrong delete, and the old data is gone. Versioning keeps it.
With versioning on, every upload to a key adds a new version with its own version id. Reads return the latest; the older ones stay until you remove them.
Turning it on
aws s3api put-bucket-versioning --bucket market-docs-181ryxm --versioning-configuration Status=Enabledaws s3api get-bucket-versioning --bucket market-docs-181ryxmThe answer says "Status": "Enabled". Once enabled, versioning cannot be switched fully off, only suspended: new uploads stop making versions and the existing ones stay.
It protects only what is written after it is on. Turn it on when the bucket is created.
Seeing the versions
aws s3api list-object-versions --bucket market-docs-181ryxm --prefix prices.csv --query "Versions[].[VersionId,IsLatest,LastModified]" --output tableOne row per version, newest first, with IsLatest true on the current one.
Every version is a full copy, stored and billed. A file uploaded every hour is 720 copies a month: lesson 5 shows how to expire old versions on a schedule.