【问题标题】:Cant see instance when apply a custom policy in IAM in AWS在 AWS 的 IAM 中应用自定义策略时看不到实例
【发布时间】:2018-06-04 08:06:02
【问题描述】:

我创建了一个限制用户访问单个实例的策略:

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "Stmt1392113879000",
      "Effect": "Allow",
      "Action": [
        "ec2:*"
      ],
      "Resource": [
        "arn:aws:ec2:us-east-1:account:instance/instance_id"
      ]
    }
  ]
}

但我收到此错误:

You are not authorized to describe Running Instances
You are not authorized to describe Elastic IPs 
You are not authorized to describe Volumes 
You are not authorized to describe Snapshots 
You are not authorized to describe Key Pairs 
You are not authorized to describe Load Balancers 
You are not authorized to describe Placement Groups 
You are not authorized to describe Security Groups

我无法在控制台中看到该实例。如果我不能实现这件事,那还有什么用策略!

我卡住了,请帮忙

【问题讨论】:

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


    【解决方案1】:

    来自iam-policies-for-amazon-ec2

    目前,并非所有 API 操作都支持单个 ARN;我们将添加 支持额外的 API 操作和额外 Amazon EC2 的 ARN 以后的资源。有关您可以使用哪些 ARN 的信息 哪些 Amazon EC2 API 操作以及支持的条件键 每个 ARN,请参阅 Amazon EC2 API 支持的资源和条件 行动。

    所以,写ec2:* 不会帮助你。相反,您应该提供您希望授予此用户的确切 API 操作。

    另外,引用上面提到的同一链接:

    要指定所有资源,或者如果特定 API 操作不支持 ARN,请在 Resource 元素中使用 * 通配符,如下所示:

    分配限制性 EC2 IAM 策略有点复杂。您可能想详细阅读上面提到的链接以及this 链接。

    【讨论】:

    • desribe 操作将对* 资源起作用。使用 describe 操作时,不能为资源指定 arn。
    • 那么这意味着我不能限制单个实例上的用户访问?
    • 您可以使其仅与单个实例的某些特定 API 操作一起工作。请阅读我提到的链接。
    • 我已阅读此内容,但是当我创建策略时,我可以看到那里给出了描述操作,但是当我为该用户标记它们时,该用户仍然无法在控制台上看到任何内容!!!奇怪的。那么这个政策有什么用呢?
    • 但在示例中的同一链接上,请参见示例 3,其中给出了针对特定实例的策略。那样有用吗 ?我可以使用 sdk 或控制台应用策略吗?
    【解决方案2】:

    检查您所在的地区。您的策略使用 US-East-1,但您的实例在哪里?美国西部 2?

    【讨论】:

    • 没有实例正在使用东 1(弗吉尼亚州)
    猜你喜欢
    • 2017-06-02
    • 2021-10-06
    • 1970-01-01
    • 2020-12-16
    • 1970-01-01
    • 1970-01-01
    • 2016-05-15
    • 1970-01-01
    • 2019-08-06
    相关资源
    最近更新 更多