cloudtools / troposphere

troposphere - Python library to create AWS CloudFormation descriptions
BSD 2-Clause "Simplified" License
4.93k stars 1.45k forks source link

reduce JSON CloudFormation template size #2028

Closed PatMyron closed 2 years ago

PatMyron commented 2 years ago

also: https://github.com/aws/serverless-application-model/pull/2368, https://github.com/aws/aws-cdk/pull/19656, https://github.com/awslabs/goformation/pull/445

CloudFormation templates can currently only be 1MB

Simply reducing indentation from 4 to 1 should remove ~1/2 of the template file size for everyone by default while still preserving indentation formatting. Beyond improving the default, those wishing to reduce readability for further reduced file size could opt into using something like jq on their own for now


for file in tests/examples_output/*.template; do
    cat <<< $(jq . --indent 1 $file) > $file
done