作者热门文章
- android - RelativeLayout 背景可绘制重叠内容
- android - 如何链接 cpufeatures lib 以获取 native android 库?
- java - OnItemClickListener 不起作用,但 OnLongItemClickListener 在自定义 ListView 中起作用
- java - Android 文件转字符串
我关注了this blog为了使用 Web Identity Federation 设置我的 AWS IAM 和 S3 帐户。我能够很好地验证和接收 session 凭据和 token 。我还可以下载和上传对象。但是,我得到:
access denied
在以下 ListMultipartUploads 请求中:
var request = new ListMultipartUploadsRequest()
{
BucketName = bucketName,
Prefix = $"{UserId}/"
};
var response = await s3Client.ListMultipartUploadsAsync(request);
附加到我的 IAM 角色的访问策略是:
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::mybucket/${myidentityprovider:userId}/*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:ListBucketMultipartUploads"
],
"Resource": [
"arn:aws:s3:::mybucket"
],
"Condition": {
"StringLike": {
"s3:prefix": "${myidentityprovider:userId}/"
}
}
}
]
}
如您所见,我拥有“s3:ListBucketMultipartUploads”权限,因此用户应该能够对他们的存储桶执行 ListMultiPartUploads。我做错了什么?
最佳答案
我在你的前缀语句中看到一个错误,
需要是一个数组,
"s3:prefix": ["${myidentityprovider:userId}/*"]
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:GetObject",
"s3:PutObject"
],
"Resource": "arn:aws:s3:::mybucket/${myidentityprovider:userId}/*"
},
{
"Effect": "Allow",
"Action": [
"s3:ListBucket",
"s3:ListBucketMultipartUploads"
],
"Resource": [
"arn:aws:s3:::mybucket"
],
"Condition": {
"StringLike": {
"s3:prefix": ["${myidentityprovider:userId}/*"]
}
}
}
]}
关于c# - AWS S3 ListMultipartUploads : access denied,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45183481/
我关注了this blog为了使用 Web Identity Federation 设置我的 AWS IAM 和 S3 帐户。我能够很好地验证和接收 session 凭据和 token 。我还可以下载
我是一名优秀的程序员,十分优秀!