我正在尝试使用 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/*"]
}
]
}
我确信这与政策有关,但我不知道是什么.. 让我感到困惑的是上传是如何工作的,但下载却是这样?
任何帮助深表感谢..