1
這是鬥政策:爲什麼這個S3存儲桶策略不允許我的IAM用戶放置對象?
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "statement1",
"Effect": "Allow",
"Principal": {
"AWS": "arn:aws:iam::xxxxxxxxxxxx:user/userName"
},
"Action": "*",
"Resource": "arn:aws:s3:::my-super-awesome-bucket-name-test/*"
}
}
使用AWS CLI我能列出桶的內容:
aws s3 ls s3://my-super-awesome-bucket-name-test
2017-06-28 19:50:42 97 testFile.csv
但是,我不能上傳文件:
aws s3 cp csv_sum.js s3://my-super-awesome-bucket-name-test/
upload failed: ./csv_sum.js to s3://my-super-awesome-bucket-name-test/csv_sum.js An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
我還需要做些什麼才能授予我的IAM用戶訪問權限?我通過aws configure添加了所需的信息,還有其他需要的東西嗎?
'aws s3 cp'命令可能需要** Bucket **的權限以及存儲桶的內容。嘗試添加''arn:aws:s3 ::: my-super-awesome-bucket-name-test「(不帶'/ *')的第二個資源。 –
事實證明,它一定是由我的AWS CLI客戶端引起的,我通過自制軟件將它安裝在我的Mac上。從我的Linux PC嘗試相同的命令沒有問題。獲得的教訓,只需堅持使用Linux – Hoofamon
要在Mac上安裝[AWS Command-Line Interface(CLI)](http://aws.amazon.com/cli/),只需使用'sudo pip install awscli'。它在Mac上運行得非常好! –