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

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


当前回答

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

其他回答

您可以使用MinIO客户端执行以下操作:mc cp -r https://s3-us-west-2.amazonaws.com/bucketName/ localdir

MinIO还支持会话、断点续传下载、上传等等。MinIO支持Linux、OS X和Windows操作系统。它是用Golang编写的,在Apache Version 2.0下发布。

当在Windows,我的首选GUI工具这是CloudBerry Explorer免费软件 Amazon S3。它有一个相当精致的文件资源管理器和类似ftp的界面。

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

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

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

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

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

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

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

rclone sync /home/local/directory remote:bucket

这里有一些东西可以下载所有桶,列出它们,列出它们的内容。

    //connection string
    private static void dBConnection() {
    app.setAwsCredentials(CONST.getAccessKey(), CONST.getSecretKey());
    conn = new AmazonS3Client(app.getAwsCredentials());
    app.setListOfBuckets(conn.listBuckets());
    System.out.println(CONST.getConnectionSuccessfullMessage());
    }

    private static void downloadBucket() {

    do {
        for (S3ObjectSummary objectSummary : app.getS3Object().getObjectSummaries()) {
            app.setBucketKey(objectSummary.getKey());
            app.setBucketName(objectSummary.getBucketName());
            if(objectSummary.getKey().contains(CONST.getDesiredKey())){
                //DOWNLOAD
                try 
                {
                    s3Client = new AmazonS3Client(new ProfileCredentialsProvider());
                    s3Client.getObject(
                            new GetObjectRequest(app.getBucketName(),app.getBucketKey()),
                            new File(app.getDownloadedBucket())
                            );
                } catch (IOException e) {
                    e.printStackTrace();
                }

                do
                {
                     if(app.getBackUpExist() == true){
                        System.out.println("Converting back up file");
                        app.setCurrentPacsId(objectSummary.getKey());
                        passIn = app.getDataBaseFile();
                        CONVERT= new DataConversion(passIn);
                        System.out.println(CONST.getFileDownloadedMessage());
                    }
                }
                while(app.getObjectExist()==true);

                if(app.getObjectExist()== false)
                {
                    app.setNoObjectFound(true);
                }
            }
        }
        app.setS3Object(conn.listNextBatchOfObjects(app.getS3Object()));
    } 
    while (app.getS3Object().isTruncated());
}

/---------------------------- 扩展方法 -------------------------------------/

//Unzip bucket after download 
public static void unzipBucket() throws IOException {
    unzip = new UnZipBuckets();
    unzip.unZipIt(app.getDownloadedBucket());
    System.out.println(CONST.getFileUnzippedMessage());
}

//list all S3 buckets
public static void listAllBuckets(){
    for (Bucket bucket : app.getListOfBuckets()) {
        String bucketName = bucket.getName();
        System.out.println(bucketName + "\t" + StringUtils.fromDate(bucket.getCreationDate()));
    }
}

//Get the contents from the auto back up bucket
public static void listAllBucketContents(){     
    do {
        for (S3ObjectSummary objectSummary : app.getS3Object().getObjectSummaries()) {
            if(objectSummary.getKey().contains(CONST.getDesiredKey())){
                System.out.println(objectSummary.getKey() + "\t" + objectSummary.getSize() + "\t" + StringUtils.fromDate(objectSummary.getLastModified()));
                app.setBackUpCount(app.getBackUpCount() + 1);   
            }
        }
        app.setS3Object(conn.listNextBatchOfObjects(app.getS3Object()));
    } 
    while (app.getS3Object().isTruncated());
    System.out.println("There are a total of : " + app.getBackUpCount() + " buckets.");
}

}