Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

AWS Serverless template resource count exceeds

I have just started migrating all my Web APIs to AWS serverless functions using VS2015 dot net core. I have total 60 resources(AWS::Serverless::Function) defined in serverless.template file. When I started uploading it through Visual Studio (Publish to AWS Lamda), I got below error.

Failed to create CloudFormation change set: Template format error: Number of resources, 267, is greater than maximum allowed, 200

I tried deleting some resources but same error comes repeatedly. Initially when I do it by just having 2,3 resources, it was working just fine.

Any help would be highly appreciated.

Edit: Below is new master template referring nested stack

{
    "AWSTemplateFormatVersion" : "2010-09-09",
    "Transform" : "AWS::Serverless-2016-10-31",
    "Resources" : {
        "FirstStack" : {
           "Type" : "AWS::CloudFormation::Stack",
           "Properties" : {
              "TemplateURL" : "https://s3-us-west-2.amazonaws.com/serverless1.template",
              "TimeoutInMinutes" : "60"
           }          
        },
        "SecondStack" : {
           "Type" : "AWS::CloudFormation::Stack",
           "Properties" : {
              "TemplateURL" : "https://s3-us-west-2.amazonaws.com/serverless2.template",
              "TimeoutInMinutes" : "60"
           }          
        }
    },    
    "Outputs": {

    }    
}
like image 913
Maria Jegan Raj Avatar asked Oct 28 '25 17:10

Maria Jegan Raj


2 Answers

If you look at Cloudformation Limits you'll see that 200 Resources is the max per template. Their recommendation is to use Nested Stacks.

like image 65
Dave Maple Avatar answered Oct 31 '25 08:10

Dave Maple


AWS Changes Posted On:

  • Oct 22, 2020

AWS Changes Posted At:

  • https://aws.amazon.com/about-aws/whats-new/2020/10/aws-cloudformation-now-supports-increased-limits-on-five-service-quotas/

5 Increased Cloudformation Limits

  • maximum size of a template that can be passed in an S3 Object

    • 1MB
    • previously 450KB
  • per template limits for the maximum number of resources

    • 500
    • previously 200
  • parameters

    • 200
    • previously 60
  • mappings

    • 200
    • previously 100
  • outputs

    • 200
    • previously 60
like image 40
Drewry Pope Avatar answered Oct 31 '25 09:10

Drewry Pope



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!