1

Below is my code to add policy but not sure what's wrong as its givng error while running for cloud formation as error occurred (ValidationError) when calling the ValidateTemplate operation: Template format error: Number of resources, 201, is greater than maximum allowed, 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
aroy
  • 452
  • 2
  • 10

2 Answers2

1

All is ok... but CloudFormation have limit of number of resources per stack of 200 resources. Look here https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html

Description: Maximum number of resources that you can declare in your AWS CloudFormation template.

Value: 200 resources

Solution: break your stack in two...

Petar Marinac
  • 151
  • 1
  • 7
0

It means exactly what the error says, your only allowed 200 resources per cloudformation stack AWS Docs. If your getting this error, with the above template, I can only assume you are using a compiler which is combining your modularised smaller yaml resources into a single file when deploying the cloudformation stack?

pkarfs
  • 993
  • 7
  • 19