我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。
有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。
我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。
有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。
当前回答
你可以用s3cmd命令简单地得到它:
s3cmd get --recursive --continue s3://test-bucket local-directory/
其他回答
AWS CLI是在本地下载整个S3存储桶的最佳选择。
安装AWS CLI。 配置AWS CLI以使用默认的安全凭据和默认的AWS区域。 下载整个S3桶使用命令 Aws s3 sync s3://yourbucketname localpath
不同AWS服务的AWS CLI参考:AWS命令行接口
当在Windows,我的首选GUI工具这是CloudBerry Explorer免费软件 Amazon S3。它有一个相当精致的文件资源管理器和类似ftp的界面。
使用boto3下载具有特定前缀的桶中的所有对象
import boto3
s3 = boto3.client('s3', region_name='us-east-1',
aws_access_key_id=AWS_KEY_ID,
aws_secret_access_key=AWS_SECRET)
def get_all_s3_keys(bucket,prefix):
keys = []
kwargs = {'Bucket': bucket,Prefix=prefix}
while True:
resp = s3.list_objects_v2(**kwargs)
for obj in resp['Contents']:
keys.append(obj['Key'])
try:
kwargs['ContinuationToken'] = resp['NextContinuationToken']
except KeyError:
break
return keys
def download_file(file_name, bucket,key):
file=s3.download_file(
Filename=file_name,
Bucket=bucket,
Key=key)
return file
bucket="gid-folder"
prefix="test_"
keys=get_all_s3_keys(bucket,prefix):
for key in keys:
download_file(key, bucket,key)
另一个可以帮助一些OS X用户的选项是Transmit。
它是一个FTP程序,还可以让您连接到S3文件。而且,它有一个选项,可以将任何FTP或S3存储作为文件夹挂载在Finder中,但这只是在有限的时间内。
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,下载就开始了。