Reputation: 1295
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?
Upvotes: 22
Views: 41413
Reputation: 200682
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.
Upvotes: 13
Reputation: 425
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
Upvotes: 24
Reputation: 92
AWS has several high-level s3
commands; aws s3 cp, aws s3 ls, aws s3 mv, aws s3 rm, and sync. You can use the aws s3 cp
like you would a copy source to destination.
aws s3 cp s3://BUCKET-NAME/PATH/FILE.EXTENTION (LOCAL_PATH/)FILE.EXTENTION
Upvotes: -4