I have a S3 bucket with versioning turned on.
File 1. -- #version 2
File 1. -- #version 1
I deleted File 1.
so now a delete marker is placed
delete marker
File 1. -- #version 2
File 1. -- #version 1
My file is File 1. latest version should be deleted so if I want to fetch File 1. after deleting. I should get the last version before version 2 which is version 1. But I do not receive any file.
I am not using version number while accessing the file but just the file name.
3
When deleting a versioned object, you are not “deleting” a version. Rather, you are “adding another version” on top of the previous versions. The latest version is a Delete Marker, which makes the object appear to be deleted, but all previous versions are still accessible.
Nothing is actually deleted unless you specifically reference a versionId
of the object when requesting the delete. If you really do want to delete Version 2 and just preserve Version 1, then your DeleteObject()
command will need to provide the versionId
of version 2.