2014-10-09 152 views
1

我在wordpress中遇到此錯誤:Error retrieving a list of your S3 buckets from AWS:Access Denied。我爲IAM用戶編寫了策略。我不知道我在做什麼錯。請幫幫我。從AWS中檢索您的S3存儲桶列表時出錯:拒絕訪問

我的IAM政策是在這裏:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
    { 
     "Sid": "Stmtxxxxxxxxxxx", 
     "Effect": "Allow", 
     "Action": [ 
     "s3:GetBucketLocation", 
     "s3:ListBucket", 
     "s3:ListBucketMultipartUploads" 
     ], 
     "Resource": [ 
     "arn:aws:s3:::bucketname/*" 
     ] 
    } 
    ] 
} 

回答

3

首先,爲了列出所有的桶,你需要創建一個可以讓你的IAM進行聲明:在整個「S3 ListAllMyBuckets」 S3帳戶

{ "Effect": "Allow", "Action": "s3:ListAllMyBuckets", "Resource": "*", "Condition": {} }

此外,它好像你有水桶上市,因爲您嘗試的動作,讓煩惱:

"Action": [ "s3:GetBucketLocation", "s3:ListBucket", "s3:ListBucketMultipartUploads" ],

必須應用於整個鬥:

"Resource": "arn:aws:s3:::bucketname",

,而你正在試圖讓這一行動桶的內容:

"Resource": "arn:aws:s3:::bucketname/*",

無論如何,請嘗試以下政策:

{ "Version": "2012-10-17", "Statement": [ { "Sid": "Stmtxxxxxxxxxxx", "Effect": "Allow", "Action": [ "s3:GetBucketLocation", "s3:ListBucket", "s3:ListBucketMultipartUploads" ], "Resource": "arn:aws:s3:::bucketname", "Condition": {} }, { "Effect": "Allow", "Action": "s3:ListAllMyBuckets", "Resource": "*", "Condition": {} } ] }

我在我的網站上測試過它,它工作。

如果您有任何其他問題,請隨時詢問。

謝謝, 弗拉德

+0

thnak你。其實我忘記給用戶一個管理訪問權限。現在一切正常。 – Kamal 2014-10-09 12:00:11