Skip to content

reduce JSON CloudFormation template size#2028

Merged
PatMyron merged 3 commits intomainfrom
json
Apr 1, 2022
Merged

reduce JSON CloudFormation template size#2028
PatMyron merged 3 commits intomainfrom
json

Conversation

@PatMyron
Copy link
Copy Markdown
Contributor

@PatMyron PatMyron commented Mar 31, 2022

also: aws/serverless-application-model#2368, aws/aws-cdk#19656, awslabs/goformation#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

@PatMyron PatMyron requested a review from markpeek March 31, 2022 19:14
PatMyron and others added 2 commits March 31, 2022 12:32
for file in tests/examples_output/*.template; do
    cat <<< $(jq . --indent 1 $file) > $file
done
mergify bot pushed a commit to aws/aws-cdk that referenced this pull request Apr 1, 2022
also: aws/serverless-application-model#2368, cloudtools/troposphere#2028
#18694
#18886
[CloudFormation templates can currently only be 1MB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html)

Simply reducing indentation from 2 to 1 should remove ~1/4 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`](https://stedolan.github.io/jq/) on their own for now

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
@PatMyron PatMyron merged commit aea9383 into main Apr 1, 2022
@PatMyron PatMyron deleted the json branch April 1, 2022 15:55
StevePotter pushed a commit to StevePotter/aws-cdk that referenced this pull request Apr 27, 2022
also: aws/serverless-application-model#2368, cloudtools/troposphere#2028
aws#18694
aws#18886
[CloudFormation templates can currently only be 1MB](https://docs.aws.amazon.com/AWSCloudFormation/latest/UserGuide/cloudformation-limits.html)

Simply reducing indentation from 2 to 1 should remove ~1/4 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`](https://stedolan.github.io/jq/) on their own for now

----

### All Submissions:

* [x] Have you followed the guidelines in our [Contributing guide?](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md)

### Adding new Unconventional Dependencies:

* [ ] This PR adds new unconventional dependencies following the process described [here](https://github.com/aws/aws-cdk/blob/master/CONTRIBUTING.md/#adding-new-unconventional-dependencies)

### New Features

* [ ] Have you added the new feature to an [integration test](https://github.com/aws/aws-cdk/blob/master/INTEGRATION_TESTS.md)?
	* [ ] Did you use `cdk-integ` to deploy the infrastructure and generate the snapshot (i.e. `cdk-integ` without `--dry-run`)?

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant