如何使在S3中公开10,000个文件文件

2023-09-11 08:16:29 作者:再爱你一次!

我在10,000个文件一斗的文件夹。似乎有没有办法上传他们,让他们公开立竿见影。所以我上传他​​们,他们是私人的,我需要让他们所有的公共。

I have a folder in a bucket with 10,000 files. There seems to be no way to upload them and make them public straight away. So I uploaded them all, they're private, and I need to make them all public.

我已经试过了AWS控制台,它只是提供了一个错误(正常工作与文件夹用更少的文件)。

I've tried the aws console, it just gives an error (works fine with folders with less files).

我已经使用在Firefox S3组织试过了,同样的事情。

I've tried using S3 organizing in Firefox, same thing.

有一些软件或一些脚本,我可以运行,使所有这些公开?

Is there some software or some script I can run to make all these public?

推荐答案

您可以生成一个桶政策(见下面的例子),它可以访问桶中的所有文件。铲斗政策可以加入到通过AWS控制台铲斗

You can generate a bucket policy (see example below) which gives access to all the files in the bucket. The bucket policy can be added to a bucket through AWS console.

{
    "Id": "...",
    "Statement": [ {
        "Sid": "...",
        "Action": [
            "s3:GetObject"
        ],
        "Effect": "Allow",
        "Resource": "arn:aws:s3:::bucket/*",
        "Principal": {
            "AWS": [ "*" ]
        }
    } ]
}

另外,也要看看Amazon提供以下策略生成工具。

Also look at following policy generator tool provided by Amazon.

http://awspolicygen.s3.amazonaws.com/policygen.html