When versioning is enabled in an Amazon S3 bucket, each object automatically receives a distinct version ID.
Deleting an object doesn't permanently remove it; instead, S3 places a deletion marker on the object. This marker indicates a deletion attempt but allows for the object's restoration by simply removing the marker.
Overwriting an object generates a new version while preserving access to its previous versions. To manage costs, consider deleting old object versions from your S3 bucket when they are no longer necessary.