对于匿名上传照片到水桶亚马逊S3斗政策 [英] Amazon S3 bucket policy for anonymously uploading photos to a bucket
本文介绍了对于匿名上传照片到水桶亚马逊S3斗政策的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我打算使用Amazon S3让用户从iPhone上传照片,然后让他们公开显示。
I am planning on using Amazon S3 to let users upload photos from an iPhone and then let them be publicly viewable.
我有一些麻烦了解如何设置这些安全性约束在桶政策:
I am having some trouble understanding how to set up these security constraints in the bucket policy:
- 每个人都可以读出每一个文件。
- 每个人都可以上传的新的文件,是最大的256K大。
- 没有人可以删除任何文件。
- 没有人可以修改任意文件。
- Everyone can read every file.
- Everyone can upload a new file that is maximum 256K large.
- No one can delete any file.
- No one can modify any file.
推荐答案
之类的好,我算出来到底。唯一的一点是,你不能在添加文件和更新文件设置不同的权限。他们都覆盖S3:PutObject。此外,它似乎没有可以限制文件大小。
Ok I sort of worked it out in the end. The only thing is that you can't set different permissions on adding files and updating files. They are all covered by s3:PutObject. Also, it doesn't seem possible to restrict file size.
{
"Version": "2008-10-17",
"Id": "policy",
"Statement": [
{
"Sid": "allow-public-read",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::bucket/*"
},
{
"Sid": "allow-public-put",
"Effect": "Allow",
"Principal": {
"AWS": "*"
},
"Action": "s3:PutObject",
"Resource": "arn:aws:s3:::bucket/*"
}
]
}
这篇关于对于匿名上传照片到水桶亚马逊S3斗政策的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文