amazon-web-services - CloudFormation 堆栈类型:'AWS::IAM::Role'
问题描述
我有一个这样的 cloudformation 模板,用于创建启动 EKS 的角色
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'moba production'
Parameters:
EKSIAMRoleName:
Type: String
Description: The name of the IAM role for the EKS service to assume.
Resources:
EKSIAMRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- eks.amazonaws.com
Action:
- 'sts:AssumeRole'
RoleName: !Ref EKSIAMRoleName
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
- arn:aws:iam::aws:policy/AmazonEKSServicePolicy
Outputs:
EKSIAMRole:
Description: EKSIAMRole
Value: !Ref EKSIAMRole
但是我收到了这条消息Missing required field Principal,请帮助解决它,谢谢
缺少必填字段 Principal(服务:AmazonIdentityManagement;状态代码:400;错误代码:MalformedPolicyDocument;请求 ID:af18b2eb-06b0-474e-82bc-b80505f544fd;代理:null)
解决方案
你有不正确的缩进。它应该是:
---
AWSTemplateFormatVersion: '2010-09-09'
Description: 'moba production'
Parameters:
EKSIAMRoleName:
Type: String
Description: The name of the IAM role for the EKS service to assume.
Resources:
EKSIAMRole:
Type: 'AWS::IAM::Role'
Properties:
AssumeRolePolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Principal:
Service:
- eks.amazonaws.com
Action:
- 'sts:AssumeRole'
RoleName: !Ref EKSIAMRoleName
ManagedPolicyArns:
- arn:aws:iam::aws:policy/AmazonEKSClusterPolicy
- arn:aws:iam::aws:policy/AmazonEKSServicePolicy
Outputs:
EKSIAMRole:
Description: EKSIAMRole
Value: !Ref EKSIAMRole
推荐阅读
- python - 打印“长”列表/数组/矩阵时如何抑制自动换行
- python - 当用户函数包含布尔条件时,为什么传递 df 列不起作用?
- java - 如何在 Jackson xml 解析器中将八位字节流解析为 json?
- javascript - 在我的项目中根据以下要求转换 json
- swift - 我的 cocoa mac 应用程序中使用的 AppleScript 在 osx 10.14 中停止工作
- node-red - 使用 NODE-RED 中的节点创建节点
- html - 在两个跨度的左侧显示图像
- c++ - Boost bjam 不会将编译器版本放在文件名中
- php - laravel 选择没有列名的模型值
- php - 如何匹配sha256输出