I am using S3 bucket as source code provider in code pipeline. If versioning is not enabled on the S3 bucket, it throws an error. My question is why it is a must to have versioning enabled on source bucket ?
The Artifact when S3 is the source is always the same object key, the new version of the object (same key) is what leads to the pipeline triggering.
CodePipeline uses the etag to manage to understand the flow so far for that execution of the pipeline, remember that a CodePipeline can have multiple executions at the same time hence it needs to have a way to identify which version of the artifact is tied to which execution.
If you were using a VCS (Version Control System) such as CodeCommit or GitHub with CodePipeline it would use the commit ID instead to identify this.