做一个公共斗亚马逊S3亚马逊、做一个

2023-09-11 23:37:30 作者:゛她入我梦 。

我怎样才能在Amazon S3中设置一个水桶那么所有的文件都是公开的只读默认?

How can I set a bucket in Amazon S3 so all the files are publicly read-only by default?

推荐答案

您可以设置一个水桶政策,在这个博客帖子详细说明:

You can set a bucket policy as detailed in this blog post:

http://ariejan.net/2010/12/24/public-readable-amazon-s3-bucket-policy/

根据@ robbyt的建议,建立一个水桶政策,以下JSON:

As per @robbyt's suggestion, create a bucket policy with the following JSON:

{
  "Version": "2008-10-17",
  "Statement": [{
    "Sid": "AllowPublicRead",
    "Effect": "Allow",
    "Principal": { "AWS": "*" },
    "Action": ["s3:GetObject"],
    "Resource": ["arn:aws:s3:::bucket/*" ]
  }]
}

重要:替换与你的水桶的名称资源

Important: replace bucket in the Resource line with the name of your bucket.