Versioning keeps the old copies, but you have to find the one you want. Each copy has a version id, the time it was uploaded, and a flag that says if it is the latest.
New command
aws s3api list-object-versions
Lists the versions of the objects whose key starts with the prefix. The --query keeps three details of each version.
Usageaws s3api list-object-versions --bucket bucket --prefix key --query 'Versions[].[VersionId,LastModified,IsLatest]' --output table
Example
aws s3api list-object-versions --bucket dragon-photos-2026 --prefix price.txt --query 'Versions[].[VersionId,LastModified,IsLatest]' --output table
text
| 3sL4kqtJlcpXroDTDmJ | 2026-11-19T09:12:00 | True | ← the latest
| KbQ1x8RzGv0TnGpwVQe | 2026-11-18T16:40:00 | False | ← an older copyThe newest version is at the top. Copy the id of the one you want; the next lab uses it to bring that copy back.