I have created an AWS S3 bucket with versioning and created a file with multiple versions. Is there any way I could download a file with a particular version using command line or API?
In the Amazon S3 console, choose your S3 bucket, choose the file that you want to open or download, choose Actions, and then choose Open or Download. If you are downloading an object, specify where you want to save it.
To list out a particular file version use below command and you will get ObjectVersionId
aws s3api list-object-versions --bucket bucketname --prefix folder/test/default.json --output json
ObjectVersionId:"Cu9ksraX_OOpbAtobdlYuNPCoJFY4N3S"
aws s3api get-object --bucket bucketname --key folder/test/default.json D:/verions/default.json --version-id Cu9ksraX_OOpbAtobdlYuNPCoJFY4N3S
Via command line:
aws s3api get-object --version-id ...
To first get a list of the available versions:
aws s3api list-object-versions ...
There are similar methods in the respective AWS SDKs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With