2017-03-06 84 views
1

我試圖讓一個基本的上傳存儲桶工作,但是我試圖圍繞所需的存儲桶策略來解決問題。s3最小上傳存儲桶政策授權

我目前有:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Sid": "AddPerm", 
      "Effect": "Allow", 
      "Principal": "*", 
      "Action": "s3:*", 
      "Resource": "arn:aws:s3:::waydope-development/*", 
      "Condition": { 
       "StringEquals": { 
        "s3:x-amz-acl": "public-read" 
       } 
      } 
     } 
    ] 
} 

的CORS設置爲允許所有。我可以通過只提供一個密鑰上傳到這個桶中,但是如果提供了授權,簽名和策略,這個桶會因爲它是開放的而返回403嗎?換句話說,我可以提供這些密鑰而不需要用戶的主要觀點嗎?

回答

0

要查看水桶政策如何與簽約這裏涉及到一個問題:s3 how is the signature calculated

這是起碼的桶政策,任何人都可以得到的,POST,PUT和水桶刪除項目。表單數據中所需的全部內容都是關鍵 - 即文件路徑。

桶配置:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Sid": "AddPerm", 
      "Effect": "Allow", 
      "Principal": "*" 
      "Action": "s3:*", 
      "Resource": "arn:aws:s3:::example-development/*" 
     } 
    ] 
} 

這是需要用戶/組認證的任何東西,除了得到桶上傳的最低桶政策。

桶配置:

{ 
    "Version": "2012-10-17", 
    "Statement": [ 
     { 
      "Sid": "Allow Get", 
      "Effect": "Allow", 
      "Principal": "*", 
      "Action": "s3:GetObject", 
      "Resource": "arn:aws:s3:::example-development/*" 
     }, 
     { 
      "Sid": "AddPerm", 
      "Effect": "Allow", 
      "Principal": { 
       "AWS": "arn:aws:iam::123456789:user/example" 
      }, 
      "Action": "s3:*", 
      "Resource": ["arn:aws:s3:::example-development/*","arn:aws:s3:::example-development"] 
     } 
    ] 
}