AWS 信任策略已禁止字段 Principal [英] AWS Trust Policy Has prohibited field Principal

查看:37
本文介绍了AWS 信任策略已禁止字段 Principal的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试根据 使用 AWS CLI 将 AWS IAM 角色附加到现有的 Amazon EC2 实例.

政策如下所示:

{
 "Version": "2012-10-17",
 "Statement": [
 {
    "Effect": "Allow",
    "Principal": {
    "Service": "ec2.amazonaws.com"
    },
    "Action": "sts:AssumeRole"
  }
 ]

}

但它给出了这个错误:

This policy contains the following error: Has prohibited field Principal

这里有一个类似的问题,但无法解决此问题.

There is a similar question here but it couldn't fix this issue.

任何帮助将不胜感激.

推荐答案

创建服务角色的最简单方法是:

  • 转到 IAM 控制台
  • 点击角色
  • 创建新角色
  • 选择一个 Amazon EC2 服务角色
  • 然后附上您的政策

它将为您创建信任策略.

It will create the trust policy for you.

请注意,信任策略存储在与实际策略(分配权限的位)不同的位置.根据错误消息,您似乎将信任策略置于正常位置,因为角色不需要原则(但信任策略需要).

Please note that the Trust Policy is stored in a separate location to the actual Policy (the bit that assigns permissions). Based upon the error message, it seems like you're putting the trust policy in the normal spot, because Roles don't need a principle (but trust policies do).

这篇关于AWS 信任策略已禁止字段 Principal的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆