S3 Object Versioning
S3 Object Versioning allows you to keep multiple versions of an object in one bucket. It can be used to preserve and retrieve all versions of any object stored in the S3 bucket.
S3 Object Versioning can protect against accidental overwrites and deletions
Versioning keeps multiple copies of the same object as a whole. Charges apply for multiple versions, e.g. A 1GB file would have 5 copies, each with minor differences. You would be charged for the 5GB storage space.
Buckets may be found in any of the three states Unversioned (the default).
Versioning-enabled
Versioning-suspended
S3 Object Versioning cannot be enabled by default. It must be enabled for each bucket.
Versioning can’t be disabled once it is enabled and can only be suspended
Versioning is enabled on a bucket for all objects within it
Permissions can be set at the version level. Each version has its own owner. An AWS account is responsible for creating the object version. You can also set different permissions to different versions of the object.
No matter what version, each object in the bucket is assigned a version ID.
Each object is assigned a unique version ID for Versioned buckets
Versioning uses version ID as a key element to identify the uniqueness of an object within the bucket. This is in addition to the bucket name and object keyObjectRetrieval.
For non-versioned bucketAn object retrieval always returns the only object available
For Versioned bucketAn objects retrieval returns the Current object.
You can retrieve non-current objects by specifying the version ID.
Non-Versioned bucket: If an object with the same key gets uploaded again, it overwrites the object
Versioned bucket: If an object with the same key has been uploaded, the new object becomes the current version and previous object becomes non-current.
An object that is not current can be retrieved and rebuilt, protecting against accidental overwrites.
Non-Versioned bucket An object is permanently deleted and can’t be recovered
All versions of the Versioned bucket are retained, but Amazon inserts a delete marker to make the Current version.
An object that is not current can be retrieved and rebuilt, protecting against accidental overwrites
A permanent deletion occurs when an object with a particular version ID is deleted. The object cannot be recovered.
The Delete Marker object doesn’t have any data or ACL associated it. It only has the key and the version ID.
A bucket with a delete mark as the Current version would return an object retrieval.
Only a DELETE operation can be performed on the Delete Marker object
If the Delete marker object has been deleted by specifying its version ID it becomes the current version object.
If an object has Delete Marker as its current version is requested, the object’s Delete marker object will not be deleted. Instead, a Delete Marker object is added againRestoring previous versions
Copy the previous version of the object to the same bucket. The object copied becomes the current version and all versions are preserved. This is recommended as it keeps all versions.
Permanently delete the current object version. You can delete the current object version and make it the current version.
To stop the accumulation of new versions of the same object within a bucket, versioning can be stopped
Existing objects in the bucket are not affected by future requests.
An object with version ID null will be added for each object that is added.
Each object addition that has the same key name is overwritten by the object with the null version ID.
A object retrieval request will always return curr