【问题标题】:AWS policy error -- Number of resources is greater than maximum allowedAWS 策略错误 -- 资源数大于允许的最大值
【发布时间】:2020-09-11 16:42:50
【问题描述】:

下面是我添加策略的代码,但不确定在调用 ValidateTemplate 操作时发生错误 (ValidationError) 时出现错误,因为它在运行云形成时出现错误:模板格式错误:资源数,201,大于最大值允许, 200\n", "stdout": "", "stdout_lines": []}

AWSTemplateFormatVersion: 2010-09-09
Description: ''
Resources:
  PSEJenkinsS3Policy:
    Type: 'AWS::IAM::ManagedPolicy'
    Properties:
      ManagedPolicyName: pse-jenkins-s3-policy
      PolicyDocument:
        Version: '2012-10-17'
        Statement:
          - Effect: Allow
            Action:
            - s3:GetObject
            - s3:ListBucket
            - s3:ListAllMyBuckets
            - s3:PutObject
            - s3:PutObjectTagging
            Resource:
            - arn:aws:s3:::pase-*/*

Outputs:
  PSEJenkinsS3PolicyOutput:
    Value: !Ref PSEJenkinsS3Policy
    Export:
      Name: PSEJenkinsS3Policy

【问题讨论】:

  • 模板没有问题。错误是由其他原因引起的。
  • 当我在该模板上运行aws cloudformation validate-template 时,它工作正常。你是如何进行验证的?
  • 您好,这是创建一个没有嵌套的新堆栈吗?

标签: amazon-web-services amazon-s3 amazon-cloudformation aws-policies


【解决方案1】:

这正是错误所说的意思,每个 cloudformation 堆栈AWS Docs 只允许 200 个资源。如果您使用上述模板遇到此错误,我只能假设您使用的编译器在部署 cloudformation 堆栈时将模块化的较小 yaml 资源组合到单个文件中?

【讨论】:

    【解决方案2】:

    一切正常...但 CloudFormation 对每堆栈 200 个资源的资源数量有限制。看这里https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html

    描述:您可以在 AWS CloudFormation 模板中声明的最大资源数。

    价值:200 个资源

    解决方案:将你的堆栈分成两部分......

    【讨论】:

      猜你喜欢
      • 2021-10-02
      • 2021-01-03
      • 2020-01-26
      • 2015-07-08
      • 1970-01-01
      • 2016-11-12
      • 2011-01-23
      • 2020-12-19
      • 2019-03-29
      相关资源
      最近更新 更多