2015-01-02 99 views
-1

我正在與amazon服務通過使用亞馬遜ios sdk插入圖像,視頻和音頻數據。 http://docs.aws.amazon.com/mobile/sdkforios/developerguide/s3transfermanager.html亞馬遜數據插入

但無法這樣做。我遵循所有步驟,但無法理解我們如何爲用戶設置角色。以下是上傳時出現的錯誤:

Error Domain=com.amazonaws.AWSSTSErrorDomain Code=0 "The operation couldn’t be completed. (com.amazonaws.AWSSTSErrorDomain error 0.)" UserInfo=0x175673b0 {Type=Sender, Message=Not authorized to perform sts:AssumeRoleWithWebIdentity, __text=(
    "\n ", 
    "\n ", 
    "\n ", 
    "\n " 
), Code=AccessDenied} 

請提供您的指導。

回答

0

在你的問題中沒有足夠的細節來幫助你,所以讓我們先做一些假設。

根據您提供的文檔鏈接,我假設您嘗試從iOS移動應用程序上傳文件到S3。

您如何在您的應用程序中獲得憑據?我假設你正在使用Cognito Identity(http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-auth.html

如果我的兩個假設是正確的,那麼錯誤消息的一個常見原因是Cognit角色信任策略中的錯誤。

角色有兩個部分,首先是由該角色授予的權限集。其次是描述誰(或什麼)有權擔任這一角色的信任政策。

對於認證用戶Cognito角色,信任策略應該是這樣的:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
    { 
     "Sid": "", 
     "Effect": "Allow", 
     "Principal": { 
     "Federated": "cognito-identity.amazonaws.com" 
     }, 
     "Action": "sts:AssumeRoleWithWebIdentity", 
     "Condition": { 
     "StringEquals": { 
      "cognito-identity.amazonaws.com:aud": "us-east-1:12345678-abcd-abcd-abcd-123456790ab" 
     }, 
     "ForAnyValue:StringLike": { 
      "cognito-identity.amazonaws.com:amr": "unauthenticated" 
     } 
     } 
    } 
    ] 
} 

有關說明如何修改現有角色,請檢查http://docs.aws.amazon.com/IAM/latest/UserGuide/modifying-role.html