我在getList调用中出现以下错误:
S3TransferManagerSample[11717:48308]listObjects失败:[Error Domain=com.amazonaws.AWS3ErrorDomain Code=1"操作无法完成。(com.amazonaws.AVS3ErrorDomain Error 1.)"UserInfo=0x7fb71412d300{HostId=qhjcOyYAPQjHhJIX5REMTN5A48ecxIkHCqt6fFwkQPBff+tKWnML9A4yQobq2C38,Message=AccessDenied,Code=AccessDened,RequestId=B6920900AB17C864}]
我创建了两个角色,一个是auth,另一个是un-auth。以下是两个角色的内联策略:
RoleARN: Cognito_(projectName)Auth_Role
oneClick_Cognito_(projectName)Auth_Role_1424434616386: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"mobileanalytics:PutEvents",
"cognito-sync:"
],
"Resource": [
""
]
}
]
}
policygen-Cognito_(projectName)Auth_Role-201502201739: {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1424435859000",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::(bucket name)/*"
]
}
]
}
RoleARN: Cognito_(projectName)Unauth_Role
oneClick_Cognito_(projectName)Unauth_Role_1424434555837: {
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"mobileanalytics:PutEvents",
"cognito-sync:"
],
"Resource": [
""
]
}
]
}
policygen-Cognito_(projectName)Unauth_Role-201502201743: {
"Version": "2012-10-17",
"Statement": [
{
"Sid": "Stmt1424436103000",
"Effect": "Allow",
"Action": [
"s3:GetObject",
"s3:ListBucket",
"s3:PutObject"
],
"Resource": [
"arn:aws:s3:::(bucket name)/*"
]
}
]
}
有人能带我过去吗?
ListBucket
权限需要授予bucket,而不是授予bucket中的密钥。你应该看看这个博客了解更多的细节。