如何授予对亚马逊网络服务上特定实例的访问权限

How to grant access to specific instances on amazon web services

我在 AWS 上有几个 ec2 实例,我想知道哪种是组织它们以保持秩序的最佳方式。 据我所知,不可能对这些实例进行分组,例如在文件夹或类似的东西的帮助下。所以我想到的解决方案是坚持命名约定。 因此,我的实例名称将如下所示:

现在我有几个 users/customers 应该只看到特定的实例(例如 customer1 应该只看到以 examplecustomer1 开头的实例)。 因此,我创建了一个策略并将其附加到用户。我的想法是在 ARN-Resourcepath 中使用通配符,但这似乎不起作用。 有人知道如何实现吗?

示例策略:

  {
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1443859866333",
      "Action": "ec2:*",
      "Effect": "Allow",
      "Resource": "arn:aws:ec2:region:account-id:instance/customer1*"
    }
  ]
}

我无法按照 documentation

找到解决方案

您无法完全隐藏尚未使用 IAM 策略的实例。您当然可以限制用户可以在实例上执行的操作,或者按照您上面的建议,或者通过 'tagging' 实例并根据这些标签向特定用户授予权限。

您可能会发现这篇博客文章很有用:

https://blogs.aws.amazon.com/security/post/Tx2KPWZJJ4S26H6/Demystifying-EC2-Resource-Level-Permissions

还有这个:

Currently, the Amazon EC2 ec2:Describe* API actions do not support resource-level permissions, so you cannot control which individual resources users can view in the console. Therefore, the * wildcard is necessary in the Resource element of the above statement. For more information about which ARNs you can use with which Amazon EC2 API actions, see Supported Resource-Level Permissions for Amazon EC2 API Actions.

从这里开始: http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/iam-policies-ec2-console.html