2016-03-28 35 views
7

我遵循http://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_examples.html#iam-policy-example-s3上的示例,了解如何授予用户对一个存储桶的访问权限。使用桶级别权限调用PutObject操作时获取访问被拒绝

然后我使用W3 Total Cache Wordpress插件测试了配置。测试失败。

我也尝试使用再生

aws s3 cp --acl=public-read --cache-control='max-age=604800, public' ./test.txt s3://my-bucket/ 

问题和失败,

upload failed: ./test.txt to s3://my-bucket/test.txt A client error (AccessDenied) occurred when calling the PutObject operation: Access Denied 

为什么我不能上传到我斗?

回答

31

要回答我的问题:授予PutObject访问

的例子政策,但我也不得不承认PutObjectAcl访问。

我不得不改变

"s3:PutObject", 
"s3:GetObject", 
"s3:DeleteObject" 
从例如

到:

"s3:PutObject", 
"s3:PutObjectAcl", 
"s3:GetObject", 
"s3:GetObjectAcl", 
"s3:DeleteObject" 
+0

是做到了!谢谢。 –

+0

谢谢!不确定为什么亚马逊自己的文档关闭。您可能还需要包含“s3:AbortMultipartUpload”,以便可以正确清除中止的上载。 – Hashcut

+0

S3政策的示例放在这里https://docs.aws.amazon.com/IAM/latest/UserGuide/access_policies_examples.html –