Replies: 3 comments 4 replies
-
I have been experimenting with some techniques and found a relatively simple way to achieve what I'm after, using out of the box features of cdk. Basically:
In a large sized template (just shy of 1MB in size) I was able to reduce it down to 750KB using this initial, simple technique. Full npm script as an example:
|
Beta Was this translation helpful? Give feedback.
-
There now seems to be https://docs.aws.amazon.com/cdk/api/v2/docs/aws-cdk-lib.StackProps.html Setting it got me down from 1.03 MB to 827901 bytes. If that leaves you just above the limit, you could use minification as suggested above to remove newlines too. |
Beta Was this translation helpful? Give feedback.
-
Hi guys, thanks a lot for the tips and workarounds. +1 on requesting AWS to provide a flag for minification or doing this by deafult. |
Beta Was this translation helpful? Give feedback.
-
I'm getting the following error in CloudFormation.
Error [ValidationError]: Template may not exceed 1000000 bytes in size.
We're using aws-cdk to manage custom 'environments' for a project. The environments are already split up into nested stacks for resources, but in some cases there can be a large number of these nested stack resources.
The resulting template therefore gets many (e.g. 100x) AWS::CloudFormation::Stack resources (the nested stack resources).
To the point where it looks like the resulting overall stack template for the CloudFormation changeset exceeeds 1000000 bytes and fails validation as it is not allowed (the limit is 1MB for templates in S3).
Does anyone have a mitigation strategy to avoid this? E.g. I've heard of preprocessors that can minify the JSON changesets, but have not seen a way of integrating this with aws-cdk.
Beta Was this translation helpful? Give feedback.
All reactions