我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。

有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。


当前回答

下面是一个总结,你必须做什么来复制整个桶:

1. 创建一个可以操作AWS s3桶的用户

遵循这篇官方文章:配置基础知识

别忘了:

勾选“编程访问”,以便有可能通过CLI处理AWS。 为用户添加正确的IAM policy,允许用户与s3桶进行交互

2. 下载、安装和配置AWS CLI

查看允许配置的链接:https://docs.aws.amazon.com/cli/latest/userguide/cli-configure-quickstart.html

您可以使用以下命令来添加您在创建用户时获得的密钥:

$ aws configure
AWS Access Key ID [None]: <your_access_key>
AWS Secret Access Key [None]: <your_secret_key>
Default region name [None]: us-west-2
Default output format [None]: json

3.使用以下命令下载内容

你可以递归cp命令,但是aws sync命令是f:

aws s3 sync s3://your_bucket /local/path

要在真正下载之前查看下载的文件是什么,可以使用——dryrun选项。 为了提高速度,可以调整s3的max_concurrent_requests和max_queue_size属性。参见:http://docs.aws.amazon.com/cli/latest/topic/s3-config.html 您可以使用——exclude和——include选项排除/包含一些文件。参见:https://docs.aws.amazon.com/cli/latest/reference/s3/

例如,下面的命令将显示桶中显示的所有.png文件。在不使用——dryrun的情况下重播命令以下载结果文件。

aws s3 sync s3://your_bucket /local/path --recursive --exclude "*" --include "*.png" --dryrun

其他回答

Windows User need to download S3EXPLORER from this link which also has installation instructions :- http://s3browser.com/download.aspx Then provide you AWS credentials like secretkey, accesskey and region to the s3explorer, this link contains configuration instruction for s3explorer:Copy Paste Link in brower: s3browser.com/s3browser-first-run.aspx Now your all s3 buckets would be visible on left panel of s3explorer. Simply select the bucket, and click on Buckets menu on top left corner, then select Download all files to option from the menu. Below is the screenshot for the same:

桶选择界面

然后浏览文件夹以下载特定位置的bucket 点击OK,下载就开始了。

你可以使用s3cmd下载你的桶:

s3cmd --configure
s3cmd sync s3://bucketnamehere/folder /destination/folder

您可以使用另一种名为rclone的工具。这是Rclone文档中的一个代码示例:

rclone sync /home/local/directory remote:bucket

除了关于aws s3同步的建议外,我还建议查看s5cmd。

根据我的经验,我发现对于多次下载或大规模下载,这比AWS CLI要快得多。

S5cmd支持通配符,这样可以工作:

S5cmd cp s3://桶名/* ./文件夹

您可以使用这个AWS cli命令将整个S3桶内容下载到本地文件夹

aws s3 sync s3://your-bucket-name "Local Folder Path"

如果你看到这样的错误

fatal error: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed (_ssl.c:581)

——no-verify-ssl(布尔)

默认情况下,AWS CLI与AWS服务通信时使用SSL。对于每个SSL连接,AWS CLI将验证SSL证书。此选项将覆盖验证SSL证书的默认行为。 参考

使用命令——no-verify-ssl来使用这个标记

aws s3 sync s3://your-bucket-name "Local Folder Path" --no-verify-ssl
aws s3 sync s3://<source_bucket> <local_destination>

是一个很好的答案,但它不会工作,如果对象在存储类冰川灵活检索,即使文件已经恢复。在这种情况下,你需要添加标志——force-glacier-transfer。