4
votes

We're building an API using AWS SAM. Build on the Lambda Node Template in CodeStar. Things were going well until our template.yml file became too big. Whenever the code is pushed and CloudFormation starts to execute the change set and create a stack for the SAM endpoints, it fails and rolls back to the last successful build.

It seems that we have too many resources that exceeds the CloudFormation limit per stack.

I tried splitting the template file and edited the buildspec to handle two template files and do two AWS CloudFormation package commands and added another artifact. But it didn't work either. As only the first template is recognized and only one stack is created.

I can't find a way to make an automated deployment that creates multiple stacks.

I'd appreciate some input into this and suggestions to handle such a scenario.

Thanks in advance.

2
did you get any solution?soheshdoshi

2 Answers

1
votes

You should try using the nested stacks pattern. Instead of splitting your current stack into multiple parallel stacks, you will create a parent stack that will in turn create multiple child stacks.

More information here.

1
votes

AWS SAM (as of SAM v1.9.0) supports nested applications which map to nested CloudFormation stacks which gets around the 200 resource limit. (AWS::Serverless::Application transforms into a AWS::CloudFormation::Stack)

https://github.com/awslabs/serverless-application-model/releases/tag/v1.9.0