2

我想只允许用户创建 t2.micro/small/medium 用于开发,并允许他们只使用现场实例。已创建 IAM 策略来限制实例的类型/大小。此外,我想限制“按需”实例(团队必须只选择现场实例)。实现它的更清洁方法是什么?

4

3 回答 3

2

试试 AWS Service Catalog .. 这正是可以在这里为您提供帮助的确切服务。

于 2020-06-22T01:59:23.587 回答
1

ec2:InstanceMarketType在您的 IAM 策略中使用条件键。

示例(未经测试):

{
    "Version": "2012-10-17",
    "Statement": {
        "Effect": "Allow",
        "Action": "*",
        "Resource": "*",
        "Condition": {
            "StringEquals": {
                "ec2:InstanceMarketType": "spot"
            }
        }
    }
}

参考:

于 2020-06-22T12:29:55.477 回答
1

允许使用该帐户进行完全访问

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "limitedSize",
      "Effect": "Deny",
      "Action": [
        "ec2:RunInstances",
        "cloudwatch:DescribeAlarms"
      ],
      "Resource": [
        "arn:aws:ec2:*:*:instance/*"
      ],
      "Condition": {
        "ForAnyValue:StringNotLike": {
          "ec2:InstanceType": [
            "t3.*",
            "t2.*"
          ]
        }
      }
    }
  ]
}
于 2021-07-20T10:52:20.983 回答