【问题标题】:Allow selected IAM users to switch role允许选定的 IAM 用户切换角色
【发布时间】:2017-07-27 10:37:07
【问题描述】:

我有两个 AWS 账户 (Account A & B)。我想允许Account B 的少数IAM 用户通过AWS IAM 角色访问Account A 的资源。

我已经创建了这个角色,它工作正常。但是,我看到任何获得角色名称的 IAM 用户都能够切换角色并访问资源。

有没有办法只允许账户 B 的特定用户能够切换到角色?

信任策略声明如下-

 {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Effect": "Allow",
      "Principal": {
        "AWS": "arn:aws:iam::Account-B:root"
      },
      "Action": "sts:AssumeRole"
    }
  ]
}

【问题讨论】:

    标签: amazon-iam


    【解决方案1】:

    您可以将应被限制担任该角色的用户添加到组中。然后,您可以使用显式拒绝将 IAM 策略附加到 IAM 组。

    {
      "Version": "2012-10-17",
      "Statement": {
        "Effect": "Deny",
        "Action": "sts:AssumeRole",
        "Resource": "arn:aws:iam::Account_A_ID:role/Rolename"
      }
    }
    

    http://docs.aws.amazon.com/IAM/latest/UserGuide/tutorial_cross-account-with-roles.html#tutorial_cross-account-with-roles.html#tutorial_cross-account-with-roles-2

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2021-04-19
      • 2021-05-30
      • 1970-01-01
      • 2022-12-08
      • 1970-01-01
      • 2012-02-24
      • 1970-01-01
      相关资源
      最近更新 更多