Ok so I tried to create nested stacks to get aroun...
# help
g
Ok so I tried to create nested stacks to get around the parameter limit errors on cloudformation and locally everything is fine but if I try and deploy I get errors about parameter count... how would I go about reducing the number of parameters so I can deploy?
t
By locally you mean with sst start?
Do nested stacks not add up parameter counts to the parent stack?
g
Yes sst start works fine, and I did not think they would but it seems they might.
t
I think a nestedstack is just a normal cdk construct afaik
g
Hmm, well is there any way to reduce the number of parameters? I'm not even sure why there are so many.
f
If you look at the template in
.build/cdk.out
for the stack that you got the error on, what are all the parameters? I recall the limit is 60 parameters per stack?
I think CDK made some improvements on this a while back https://github.com/aws/aws-cdk/issues/3463
g
The limit is actually 200 and I have 228 with 99.99% of them being this:
f
How many Lambda functions are there in the stack?
g
In the stack that specifically is 0 but theres nested stacks that add up to around 100 I can check the exact amount real quick
144 actually a bit more than I though
f
before you switched over to nested stacks, all of these 144 lambdas are in the same stack?
g
For the most part yeah the only other stack I have is a react site so if that creates any then a small portion will be that
But I had hit the parameter limit which is why I tried to change to nested stacks but it didnt seem to help
f
144 lambdas in a stack seem a lot.. I’d split them up into multiple stacks
^without using nested stacks
g
Yeah that is what I am doing now
j
you could also group the related lambdas into one lambda with a koa server redirecting to controller methods
and then you get the benefit of having a hot start much more frequently
f
CloudFormaiton is also known to get slower the more resources you have in a stack.
g
Yeah cloudformation is not the fastest currently though the frontend site still takes longer because cloudfront is even slower
t
Yeah I used to not make a lot of stacks but now I split things up aggressively because it lets CloudFormation deal with smaller bites
g
Yeah I now just have a top level resource stack follow by top level stacks for each api resource I have so like users stack todos stack etc
at least once I can get it working 😅 getting errors with creating a stack now saying it cant read the root node 🤔