【问题标题】:Value of property Roles must be of type List of String || AWS SAM属性 Roles 的值必须是 List of String || 类型AWS SAM
【发布时间】:2023-03-30 16:27:01
【问题描述】:

在尝试部署 AWS SAM 时,堆栈创建失败并出现以下错误:

属性 Roles 的值必须是字符串列表类型

由于模板文件非常大,我只为策略部分提供部分

  Policies:
    Type: AWS::IAM::Policy
    Properties:
      PolicyName: !Join ['',['lambdaExecutionPolicy',!FindInMap [Variables,Vid,value]]]
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Action: 'dynamodb:Query'
            Resource: '*'
          - Effect: Allow
            Action: 'logs:*'
            Resource: 'arn:aws:logs:*:*:*'
          - Effect: Allow
            Action:
              - 's3:GetObject'
              - 's3:PutObject'
            Resource: 'arn:aws:s3:::*'
          - Effect: Allow
            Action:
              - 'logs:CreateLogGroup'
              - 'logs:CreateLogStream'
              - 'logs:PutLogEvents'
            Resource: '*'
          - Effect: Allow
            Action:
              - 'logs:CreateLogGroup'
              - 'logs:CreateLogStream'
              - 'logs:PutLogEvents'
            Resource: '*'
          - Effect: Allow
            Action: 'sns:Publish'
            Resource: !Ref mysubscription
      Roles: !Ref lambdaexecutionrole'

在执行 CFT 时

【问题讨论】:

  • 进展如何?角色成功了吗?

标签: amazon-web-services aws-lambda amazon-cloudformation aws-sam


【解决方案1】:

根据文档,Roles 的形式为:

  Roles: 
    - String

因此,在您的情况下,您应该:

Roles: 
  - !Ref lambdaexecutionrole

或

Roles: [!Ref lambdaexecutionrole]

【讨论】:

    猜你喜欢
    • 2020-11-04
    • 1970-01-01
    • 2019-04-22
    • 2020-09-24
    • 2015-04-12
    • 2021-12-05
    • 2020-07-14
    • 1970-01-01
    • 2016-02-20
    相关资源
    最近更新 更多