gpt4 book ai didi

amazon-web-services - AWS 无服务器框架 : MalformedPolicyDocument Error while creating IAM Role and Policy

转载 作者:行者123 更新时间:2023-12-03 07:29:35 24 4
gpt4 key购买 nike

我正在尝试通过无服务器模板创建 IAM 角色和策略。

当我尝试部署此程序时,出现错误 -

An error occurred: SQSConnectPolicy - Syntax errors in policy. (Service: AmazonIdentityManagement; Status Code: 400; Error Code: MalformedPolicyDocument

这是我的 serverless.yml 文件的片段

SQSConnectRole:
Type: 'AWS::IAM::Role'
Properties:
RoleName: SqSConnectRole
AssumeRolePolicyDocument:
Version: '2012-10-17'
Statement:
- Action:
- 'sts:AssumeRole'
Effect: Allow
Principal:
Service:
- iot.amazonaws.com
Path: /service-role/

SQSConnectPolicy:
Type: 'AWS::IAM::Policy'
Properties:
PolicyName: SqSConnectPolicy
Roles:
- !Ref SQSConnectRole
PolicyDocument:
Version: 2012-10-17
Statement:
- Effect: Allow
Action: 'sqs:SendMessage'
Resources:
- arn:aws:sqs:${self:provider.region}:#{AWS::AccountId}:connectDeviceSQSDemo

在同一个 Serverless.yml 文件中创建策略和角色是否有效?

我需要添加依赖项吗?对上述问题有任何意见吗?

最佳答案

您的 IAM 政策中存在拼写错误。 Resources 一词应更改为 Resource

关于amazon-web-services - AWS 无服务器框架 : MalformedPolicyDocument Error while creating IAM Role and Policy,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/58976146/

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