2012-11-08 48 views
0

我試圖設置只讀訪問亞馬遜上的特定文件夾。我在裏面有一個'企業'桶和文件夾'軟件'。出於某種原因,下面的代碼不爲我工作(我用雲莓的驗證):亞馬遜S3文件夾的只讀訪問

{ 
    "Statement": [ 
    { 
     "Effect": "Allow", 
     "Action": [ 
      "s3:Get*", 
      "s3:List*" 
     ], 
     "Resource": "arn:aws:s3:::corporate/software/*" 
    } 
    ] 
} 

但是,如果使用:

"Resource": "*" 

我能看到所有的桶... 我錯過了什麼嗎?下面

回答

1

代碼爲我工作:

{ 
    "Statement": [ 
{ 
    "Effect": "Allow", 
    "Action": [ 
     "s3:ListBucket", 
     "s3:GetBucketLocation", 
     "s3:ListBucketMultipartUploads" 
    ], 
    "Resource": "arn:aws:s3:::corporate", 
    "Condition": {} 
    }, 
    { 
    "Effect": "Allow", 
    "Action": [ 
     "s3:GetObject", 
     "s3:GetObjectAcl", 
     "s3:GetObjectVersion", 
     "s3:GetObjectVersionAcl" 
    ], 
    "Resource": "arn:aws:s3:::corporate/software/*", 
    "Condition": {} 
    }, 
    { 
     "Effect": "Allow", 
     "Action": "s3:ListAllMyBuckets", 
     "Resource": "*", 
     "Condition": {} 
    } 
] 
}