在我的Amazon EC2实例中,我有一个名为uploads
的文件夹。在此文件夹中,我有1000张图像。现在,我要将所有图像复制到新的S3存储桶中。我怎样才能做到这一点?
最佳答案
第一个选项sm3cmd
使用s3cmd
s3cmd get s3://AWS_S3_Bucket/dir/file
看看this s3cmd documentation
如果您使用的是Linux,请在命令行上运行此命令:
sudo apt-get install s3cmd
或Centos,Fedore。
yum install s3cmd
用法示例:
s3cmd put my.file s3://pactsRamun/folderExample/fileExample
第二种选择
使用Cli from amazon
更新资料
就像评论中的@ tedder42一样,不要使用
cp
,而要使用 sync
。看一下以下语法:
aws s3 sync <source> <target> [--options]
例:
aws s3 sync . s3://my-bucket/MyFolder
有关更多信息和示例,请访问Managing Objects Using High-Level s3 Commands with the AWS Command Line Interface
关于amazon-web-services - 如何使用命令行将文件从Amazon EC2移至S3存储桶,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28396065/