I want to be able to download a specific version of a file in S3.
Based on the current documentation, it seems this is not possible. Perhaps it is possible with some optional arguments which might not be mentioned in the documentation.
The documentation says:
s3.meta.client.download_file('mybucket', 'hello.txt', '/tmp/hello.txt')Similar behavior as S3Transfer's download_file() method, except that parameters are capitalized. Detailed examples can be found at S3Transfer's Usage.
But the docs for "S3Transfer" are not linked to anywhere. The github README for S3Transfer just says to use boto3.
My current workaround is to:
We should probably update that documentation. You can provide a specific version using ExtraArgs:
import boto3
s3 = boto3.client('s3')
s3.download_file('mybucket, 'hello.txt', '/tmp/hello.txt', ExtraArgs={'VersionId': 'foo'})
Yeah, I think that doc update is still required. I was about to mess around with get_object because the ability to specify a version when using download_file is not documented.
Yep, same here.
Here are the list of download arguments:
https://boto3.amazonaws.com/v1/documentation/api/latest/reference/customizations/s3.html#boto3.s3.transfer.S3Transfer.ALLOWED_DOWNLOAD_ARGS
So where do we add the documentation for this?
Is this the right file?
Most helpful comment
We should probably update that documentation. You can provide a specific version using
ExtraArgs: