gpt4 book ai didi

amazon-s3 - 使用 AWS IAM 角色和策略访问具有特定 "tag"的 s3

转载 作者:行者123 更新时间:2023-12-04 12:24:51 25 4
gpt4 key购买 nike

我想创建一个 AWS IAM 策略,这样附加的角色应该可以访问所有具有标签“Team = devops”的 S3 存储桶。我尝试了以下 JSON 文件,但它不起作用。

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "*",
"Resource": "arn:aws:s3:::*",
"Condition": {
"StringEquals": {"s3:ResourceTag/Team": "devops"}
}
}
]
}

最佳答案

根据 Available Condition Keys , s3:ResourceTag 不适用于 S3 条件。

The predefined keys available for specifying conditions in an Amazon S3 access policy can be classified as follows:



Object Tagging and Access Control Policies ,可以使用 来控制每个对象的访问权限s3:ExistingObjectTag 条件键。

The following permissions policy grants a user permission to read objects, but the condition limits the read permission to only objects that have the following specific tag key and value.

security : public


{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::examplebucket/*",
"Principal": "*",
"Condition": { "StringEquals": {"s3:ExistingObjectTag/security": "public" } }
}
]
}

关于amazon-s3 - 使用 AWS IAM 角色和策略访问具有特定 "tag"的 s3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60261740/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com