单个IAM策略可供多个用户访问特定的S3存储桶

0

【以下的问题经过翻译处理】 我想为IAM创建一个策略。我有3个IAM用户和3个S3桶。每个用户只能访问一个桶。是否可以创建一个IAM策略来满足要求,还是必须创建3个不同的策略?谢谢。

1 Answer
0

【以下的回答经过翻译处理】 您可以在IAM用户和对应的存储桶上使用相同的标签,然后创建策略,如果这些标签的值相同,则允许访问,为每个用户使用相同的策略。类似这样:

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Action": s3:*,
        "Resource": "*",
        "Condition": {"StringEquals": 
            {"aws:ResourceTag/Owner": "${aws:PrincipalTag/Name}"}}
    }
}
profile picture
EXPERT
answered 5 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions