我想在asp.net核心中的localhost上为minio bucket设置下载策略。 我写下面的代码。但它不起作用。谁能帮我?谢谢。
string policy = @"{{""Version"":""2012-10-17"",""Statement"":[{{""Action"":[""s3:GetObject"", ""s3:ListBucket""],""Effect"":""Allow"",""Principal"":{{""AWS"":[""*""]}},""Resource"":[""arn:aws:s3:::bucket2/*""],""Sid"":""AddPerm""}}";
await minioClient.SetPolicyAsync("bucket2", policy);
答案 0 :(得分:0)
经过一段时间的努力,我找到了一种变通方法来找出:
首先,我打开minio web client并检查了存储桶的策略。我发现它和S3一样。
现在您可以generate your own policy并使用它们了。您也可以使用AWS Policy generator了解JSON格式。确保提供准确的信息。
当您提供endpoint
,secretKey
和accessKey
时,它将在您的minio中找出您正在谈论的存储桶/资源。
这个例子对我有用。
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:ListBucketMultipartUploads",
"s3:GetBucketLocation",
"s3:ListBucket"
],
"Resource": [
"arn:aws:s3:::my-bucket"
]
},
{
"Effect": "Allow",
"Principal": {
"AWS": [
"*"
]
},
"Action": [
"s3:ListMultipartUploadParts",
"s3:PutObject",
"s3:AbortMultipartUpload",
"s3:DeleteObject",
"s3:GetObject"
],
"Resource": [
"arn:aws:s3:::my-bucket/*"
]
}
]
}