在 Amazon S3 中公开存储桶 [英] Make a bucket public in Amazon S3

查看:45
本文介绍了在 Amazon S3 中公开存储桶的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在 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/*" ]
  }]
}

重要:将 Resource 行中的 bucket 替换为您的存储桶名称.

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

这篇关于在 Amazon S3 中公开存储桶的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆