【问题标题】:Redshift GetClusterCredentials IAM policy to require DbNameRedshift GetClusterCredentials IAM 策略需要 DbName
【发布时间】:2019-12-12 19:13:36
【问题描述】:

如何定义 IAM 策略以有效地要求 DbName?

我想要做的是只允许使用指定的白名单 DbName 调用 GetClusterCredentials。问题是 DbName 参数是可选的。我还指定了 DbUser 资源,以便我可以在 IAM 策略条件中引用 ${redshift:DbUser}

【问题讨论】:

    标签: amazon-web-services amazon-redshift amazon-iam


    【解决方案1】:

    GetClusterCredentials 支持的条件键之一是redshift:DbName,可用于根据数据库名称限制 IAM 策略。例如,如果 DbName 未设置为“test-db”,则以下策略语句应拒绝该操作。

    {
      "Sid": "GetClusterCredsStatement",
      "Effect": "Allow",
      "Action": [
        "redshift:GetClusterCredentials"
      ],
      "Resource": [
        "arn:aws:redshift:us-west-2:123456789012:dbname:examplecluster/*"
      ],
      "Condition": {
        "StringEquals": {
          "redshift:DbName": "test-db"
        }
      }
    }
    

    【讨论】:

    • 谢谢,这就是我所缺少的 - 我忘记了您可以在条件键中使用 redshift:DbName,而不仅仅是作为资源。这也允许您在 "Null": {"redshift:DbName": "true"} 上有一个明确的 DENY
    猜你喜欢
    • 2020-12-26
    • 2022-08-17
    • 1970-01-01
    • 2016-06-05
    • 2016-06-14
    • 2023-04-07
    • 1970-01-01
    • 2017-11-26
    • 2020-09-04
    相关资源
    最近更新 更多