Best way to get around the 60 Parameter Limit in CloudFormation

Hi all. So I need to consolidate an artifact repo and openshift into a nested stack and I’m trying to call all the required parameters into the root stack template which requires 61 parameters…however 60 is the limit for CloudFormation, funny how things work sometimes. Is there a way around this? Perhaps I should see if i can get rid of the 61st parameter? Is there a way to keep it? Thanks :slight_smile:


Related discussions:

Encode a couple of similar parameters together into a single parameter, separated with a comma. Then, in your CF template you can split on the parameter to get the first or second values.

But, I’d probably try to refactor the template a bit to cut down on the number of parameters required, if possible.

You can use a mapping or list to jam multiple values into a single Parameter. Keep in mind that the maximum length for a Parameter value is 4096 bytes.

Great advice! :slight_smile: Thanks.

Store the values in secrets manager and reference them in place of stack parameters. Unfortunately this doesn’t work for custom resources.

https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/dynamic-references.html

Edit: limit is also 60.

I don’t use parameters at all in my templates. Here’s how I do it:

I have a python program that I wrote that uses jinja2 templating library. I wrote a few jinja templates for each type of CF template I need deploy. I pass in the variables to the python program, it renders a bespoke CF template with all the variables where they need to be, and puts a copy in my local repo and one in S3 where I can deploy it easily.

There is no limit to variables in jinja and I find it far less cumbersome than dealing with pure CF stuff.

You should maybe look at splitting up those stacks. Not sure if you really need to have them all in a single CF template.

This is smart I’ll look into doing an approach inspired off this in the future.

I can share some examples if you want or need them. It’s not the best thing I’ve ever done, but it solves my problem and gives me a way to automate these by just passing in a file with all the variables. I’ve been able to use the program itself to manage building new templates and deploying them in pipelines as well.

Can you describe what those parameters are? Sixtyone parameters sound excessive even for a large stack.

Use the cdk