gpt4 book ai didi

aws-cloudformation - SAM 创建新角色和新政策

转载 作者:行者123 更新时间:2023-12-03 07:26:45 25 4
gpt4 key购买 nike

我正在尝试创建一个新角色和一项附加的新政策 到同一模板中创建的相同角色并获取 这个错误:

错误:

Missing required field Principal(Service:AmazonIdentityManagement;
Status Code: 400;Error Code: MalformedPolicyDocument;Proxy: null)

Resources:
lambdaFullPolicy:
Type: AWS::IAM::ManagedPolicy
Properties:
PolicyDocument:
Version: '2012-10-17'
Statement:
- Effect: Allow
Action: "*"
Resource: "*"
LambdaFullRole:
Type: AWS::IAM::Role
Properties:
AssumeRolePolicyDocument:
Version : '2012-10-17'
Statement :
- Effect : Allow
- Principal :
service :
- lambda.amazonaws.com
- Action :
- sts: AssumeRole
ManagedPolicyArns:
- !Ref lambdaFullPolicy
DependsOn:
- lambdaFullPolicy



#------------------------------output -----------------------#

Outputs:
PolicyFullLambda:
Description: table
Value: !Ref lambdaFullPolicy
Export:
Name:
"Fn::Sub": "${AWS::StackName}-PolicyFullLambda"
RollFullLambda:
Value: !Ref LambdaFullRole
Export:
Name:
"Fn::Sub": "${AWS::StackName}-RollFullLambda"

最佳答案

sts: AssumeRole 中有一个额外的空格,应为 sts:AssumeRole。这是因为这不是 YAML 组件,而是 AWS 用于角色创建/更新的 Action 部分的字符串文字。

关于aws-cloudformation - SAM 创建新角色和新政策,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69621364/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com