如何通过内联策略仅允许在属于特定AWS账户的存储桶上执行s3:putobject操作?

0

【以下的问题经过翻译处理】 我在IAM Identity Center上使用了权限集,以允许对多个账户进行只读权限的访问。我在这个权限集上附加了AWS管理策略"ReadOnlyAccess"。

对于其中一个账户,我想添加一个内联策略在这个权限集上,以允许s3:putobject访问,但我不知道如何使用内联策略仅允许访问属于特定AWS账户的存储桶?

profile picture
EXPERT
asked 6 months ago36 views
1 Answer
0

【以下的回答经过翻译处理】 您可以添加一个条件,来比较存储桶所属账户和主体账户。例如:

{
  "Version":"2012-10-17",
  "Statement":[
    {
      "Sid":"Stmt1677693648738",
      "Action":[
        "s3:PutObject"
      ],
      "Effect":"Allow",
      "Resource":"arn:aws:s3:::mybucket/*",
      "Condition":{
        "StringEquals":{
          "s3:ResourceAccount":"${aws:PrincipalAccount}"
        }
      }
    }
  ]
}
profile picture
EXPERT
answered 6 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