【问题标题】:AWS IAM policy for security group not working安全组的 AWS IAM 策略不起作用
【发布时间】:2021-09-03 11:10:49
【问题描述】:

为了实施 this,我创建了 AWS 策略

{
    "Version": "2012-10-17",
    "Statement": [
        {
            "Sid": "UpdateIngress",
            "Effect": "Allow",
            "Action": [
                "ec2:RevokeSecurityGroupIngress",
                "ec2:AuthorizeSecurityGroupIngress"
            ],
            "Resource": "arn:aws:ec2:us-west-2:***:security-group/lc-github-action-ips"
        },
        {
            "Sid": "DescribeGroups",
            "Effect": "Allow",
            "Action": "ec2:DescribeSecurityGroups",
            "Resource": "*"
        }
    ]
}

然后将其分配给用户。我尝试运行以下命令来测试这个

aws ec2 describe-security-groups --filters Name=group-name,Values=lc-github-action-ips

但它没有返回任何东西。如果我使用管理员用户运行上述命令,它会在 Json 中返回安全组详细信息

我在这里缺少什么?

【问题讨论】:

    标签: amazon-ec2 amazon-iam aws-security-group


    【解决方案1】:

    您为其分配策略的用户似乎没有编程访问权限。

    在 .aws/credentials 文件中使用新用户的访问密钥 ID/秘密访问密钥创建了一个新用户和一个新配置文件。

    使用新配置文件成功运行如下相同的命令,保持策略与您共享的相同(区域和帐户除外)。

    aws ec2 describe-security-groups --filters Name=group-name,Values=lc-github-action-ips  --profile newuserprofile
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2018-05-08
      • 2014-07-05
      • 2016-06-05
      • 2013-04-05
      • 1970-01-01
      • 1970-01-01
      • 2021-02-24
      相关资源
      最近更新 更多