我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。
有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。
我注意到似乎没有从AWS管理控制台下载整个s3桶的选项。
有什么简单的方法可以把所有东西都装进我的桶里吗?我正在考虑使根文件夹公共,使用wget抓取它,然后再次使它私有,但我不知道是否有更简单的方法。
当前回答
Aws同步是完美的解决方案。它不是双向的。从源头到目的地只有一条路。此外,如果你在bucket中有很多项目,首先创建s3端点将是一个好主意,这样下载就会更快(因为下载不是通过互联网进行的,而是通过内部网进行的),而且不收费
其他回答
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 S3 CLI下载:
aws s3 cp s3://WholeBucket LocalFolder --recursive
aws s3 cp s3://Bucket/Folder LocalFolder --recursive
要使用代码下载,请使用AWS SDK。
要使用GUI下载,请使用Cyberduck。
你可以使用s3cmd下载你的桶:
s3cmd --configure
s3cmd sync s3://bucketnamehere/folder /destination/folder
您可以使用另一种名为rclone的工具。这是Rclone文档中的一个代码示例:
rclone sync /home/local/directory remote:bucket
100%为我工作,我已经下载了所有的文件从aws s3备份。
安装AWS CLI。选择您的操作系统并按照以下步骤操作:安装或更新AWS CLI的最新版本 检查AWS版本:AWS——version
执行config命令:aws configure
Aws s3 cp s3://yourbucketname你的\本地\路径——递归
例如(Windows操作系统):aws s3 cp s3://yourbucketname C:\aws-s3-backup\project-name——recursive
请查看此链接:如何从S3下载整个存储桶到本地文件夹
使用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)