-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Description
Description
Allow options when deploying using the cdk cli that would result in physically smaller CloudFormation template.
Currently the template that is generated and deployed is formatted as JSON with whitespace.
From our testing, simply removing the whitespace can result in a template that is roughly 50% of the size.
Outputting the template as YAML also decreases the template size by roughly the same amount.
Use Case
We have a CDK project that has several lambda functions behind an API. We just ran into the limit where a CloudFormation template has to be less than 1MB.
The number of resources we have is relatively low, but due to the auto generated names of resources the template size is quite large.
If we could minify the template before deploying, or if we could have CDK deploy the template as YAML, we would be able to halve the size of the template and deploy twice as many resources.
Proposed Solution
This would be a combination of previously proposed solutions.
#8712
The above issue suggests having an option to compact the whitespace. This seems like a reasonable proposal.
#2965
The above issue mentions including the option of writing YAML to cdk.out. This appears to have been rejected on the premise that the folder is for machines to read, and that the only benefit of YAML is that it's human readable.
This ignores the fact that the YAML format results in a significantly smaller file size, and that AWS CloudFormation has a hard limit on template file sizes.
Other information
No response
Acknowledge
- I may be able to implement this feature request
- This feature might incur a breaking change