Getting specific version of file from S3 bucket

旧时模样 提交于 2019-12-10 13:43:26

问题


I have a file in a S3 bucket with versioning turned on. Using the aws-cli is there a way to copy a specific version of this file, rather than the latest version?


回答1:


Yes you can do that see this example you will need the version ID for the object.

aws s3api get-object --bucket mybucket --key file1.txt --version-id Mj1.PcWG8e.C._7LhvFU131pXJ98abIl foo.txt

Also you can list the version for getting the version ID using this commands.

aws s3api list-object-versions --bucket mybucket



回答2:


Yes, use aws s3api get-object and specify --version-id

More info here http://docs.aws.amazon.com/cli/latest/reference/s3api/get-object.html



来源:https://stackoverflow.com/questions/38599477/getting-specific-version-of-file-from-s3-bucket

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!