我正在學習AWS CLI,但我試圖從本地文件夾複製到S3中的存儲桶...因此,當我鍵入命令輸出返回下一個錯誤:存儲桶策略編輯器:策略無法解析爲有效的JSON字符串
upload failed: ./lalala.txt to s3://buecket_name/ An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
所以我搜一下這個和互聯網告訴我,問題是在桶策略編輯器,所以我嘗試編輯政策,但是當我點擊保存錯誤是:
Bucket Policy Editor:Policy could not be parsed as a valid JSON string
我的策略腳本:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets"
"Resource": "arn:aws:s3:::bucket-name*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::bucket-name"
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}
_____UPDATE_____:
所以,球員,我試圖改變腳本添加 「校長」,因爲下面的人建議,但錯誤繼續:
Policy could not be parsed as a valid JSON string
當前腳本:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:ListAllMyBuckets",
"Resource": "arn:aws:s3:Sao Paulo:X1X8XX6YYY16X:name-bucket*"
},
"Principal": {
"AWS": [
"arn:aws:iam::AWS-account-ID:root"
]
}
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:GetBucketLocation",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::bucket-name"
},
{
"Effect": "Allow",
"Action": [
"s3:PutObject",
"s3:GetObject",
"s3:DeleteObject"
],
"Resource": "arn:aws:s3:::bucket-name/*"
}
]
}
所以大家好,我做錯了什麼?
感謝先進!
我把逗號,現在的錯誤是:'缺少必填字段主體 - 未定義' –
@DouglasDiasdaSilva - 您需要指定一個描述誰可以訪問您的S3存儲桶的「Principal」字段。詳情請見[S3 Documentation](http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-bucket-user-policy-specifying-principal-intro.html)。 – birryree