我正在尝试使用iOS sdk(swift)从我的s3存储桶下载图像,但我总是收到access-denied
错误
Domain=com.amazonaws.AWSS3ErrorDomain Code=1 "(null)" UserInfo={HostId=asadadadadadad=, Message=Access Denied, Code=AccessDenied, RequestId=A467438974F8127B}]
当我不使用任何ACL设置时,上传工作正常。如果我设置ACL
let uploadRequest = AWSS3TransferManagerUploadRequest()
uploadRequest.ACL = AWSS3ObjectCannedACL.AuthenticatedRead
上传和播放下载失败。
下面是我的认知& IAM政策
{
"Version": "2012-10-17",
"Statement": [
{
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Effect": "Allow",
"Resource":["arn:aws:s3:::yimages/*"]
},{
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Effect": "Allow",
"Resource":["arn:aws:s3:::yimages"]
}
]
}
和
{
"Version":"2012-10-17",
"Statement":[
{
"Sid":"AddCannedAcl",
"Effect":"Allow",
"Principal": "*",
"Action": [
"s3:GetObject",
"s3:PutObject"
],
"Resource":["arn:aws:s3:::yimages/*"]
}
]
}
我确信这是政策的结果,但是我无法弄清楚是什么......令我困惑的是上传的工作方式如何下载?
任何帮助都非常感谢..
答案 0 :(得分:0)
"Action": [ "s3:GetBucketLocation", "s3:ListBucket", "s3:ListAllMyBuckets" ]