我正在按照本教程操作,以使django应用程序将文件直接上传到S3。
创建新的IAM用户时,我启用了对S3的完全访问权限。 AmazonS3FullAccess
但是当我上传文件时,仍然出现
错误An error occurred (AccessDenied) when calling the PutObject operation: Access Denied
然后,我尝试将策略添加到我的S3存储桶。
但是我经常收到“政策无效”的错误
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:ListAllMyBuckets",
"s3:GetBucketLocation"
],
"Resource": "*",
"Principal": { "AWS": "[my-IAM user]" }
},
{
"Effect": "Allow",
"Action": "s3:ListBucket",
"Resource": "arn:aws:s3:::[s3-bucket-name]",
"Condition": {
"StringLike": {
"s3:prefix": [
"",
"home/",
"home/${aws:username}/*"
]
}
},
"Principal": { "AWS": "[my-IAM user]" }
},
{
"Effect": "Allow",
"Action": "s3:*",
"Resource": [
"arn:aws:s3:::[bucket-name]/home/${aws:username}",
"arn:aws:s3:::[bucket-name]/home/${aws:username}/*"
],
"Principal": { "AWS": "[my-IAM user]" }
}
]
}
那我该怎么办?