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

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


当前回答

AWS CLI是在本地下载整个S3存储桶的最佳选择。

安装AWS CLI。 配置AWS CLI以使用默认的安全凭据和默认的AWS区域。 下载整个S3桶使用命令 Aws s3 sync s3://yourbucketname localpath

不同AWS服务的AWS CLI参考:AWS命令行接口

其他回答

@Layke的回答很好,但如果你有大量的数据,不想永远等待,你应该阅读“AWS CLI S3配置”。

以下命令将告诉AWS CLI使用1,000个线程执行作业(每个小文件或多部分副本的一部分),并查看100,000个作业:

aws configure set default.s3.max_concurrent_requests 1000
aws configure set default.s3.max_queue_size 100000

运行这些之后,你可以使用简单的sync命令:

aws s3 sync s3://source-bucket/source-path s3://destination-bucket/destination-path

or

aws s3 sync s3://source-bucket/source-path c:\my\local\data\path

在一个拥有4核CPU和16GB RAM的系统上,对于像我这样的情况(3-50GB文件),同步/复制速度从9.5MiB/s提高到700+MiB/s,比默认配置提高了70倍。

如果桶相当大,有一个叫做s4cmd的命令可以进行并行连接,提高下载时间:

把它安装在Debian上就像

apt install s4cmd

如果你有pip:

pip install s4cmd

它将读取~/。s3cfg文件(如果没有安装s3cmd并运行s3cmd——configure),或者您可以在命令上指定——access-key=ACCESS_KEY——secret-key=SECRET_KEY。

命令行类似于s3cmd。在这种情况下,建议同步,因为您可以取消下载并重新启动,而不必重新下载文件。

s4cmd [--access-key=ACCESS_KEY --secret-key=SECRET_KEY] sync s3://<your-bucket> /some/local/dir

如果你下载了很多数据(>1TB),这可能会影响你的账单,先计算一下这将是成本

您有许多选项可以做到这一点,但最好的是使用AWS CLI。

下面是一篇简介:

Download and install AWS CLI in your machine: Install the AWS CLI using the MSI Installer (Windows). Install the AWS CLI using the Bundled Installer for Linux, OS X, or Unix. Configure AWS CLI: Make sure you input valid access and secret keys, which you received when you created the account. Sync the S3 bucket using: aws s3 sync s3://yourbucket /local/path In the above command, replace the following fields: yourbucket >> your S3 bucket that you want to download. /local/path >> path in your local system where you want to download all the files.

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,下载就开始了。

您可以使用这个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