做一个公共斗亚马逊S3 [英] Make a bucket public in Amazon S3

查看:194
本文介绍了做一个公共斗亚马逊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:

<一个href="http://ariejan.net/2010/12/24/public-readable-amazon-s3-bucket-policy/">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.

这篇关于做一个公共斗亚马逊S3的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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