how to pass md5 checksum as a parameter using transfer.upload_file()?

1.7k Views Asked by At

I want to pass the precalculated md5 checksum of a file as a parameter[Boto3], so that s3 checks against its own calculated md5/etag and discards if the md5 doesn't match. (I do know that in multipart etag is not md5). Is there a way to do it with(s3transfer) transfer.upload_file()? Or any other way to do that? Please point me in right direction. Thanks

1

There are 1 best solutions below

2
On BEST ANSWER

You can only store the md5 into metadata and use it as verification as describe here, to use md5 as verification , it is only possible using put_object

s3 tranfer allow you to save the metadata but without verification ability .

transfer.upload_file('/tmp/myfile', 'bucket', 'key',
                     extra_args={'Metadata': {'a': 'b', 'c': 'd'}})