Skip to content

[cli] cdk synth should allow for an option to compact the template file (remove whitespaces) #8712

@mcliff1

Description

@mcliff1

When producing JSON output cdk synth should have an option to minimize the output template file size.

Use Case

AWS Cloudformation has a limit on the template body size for an template on S3 at 460,800 bytes.

I had attempted to inject this type of filtering after cdk synth in the cdk deploy flow, but quickly got lost.

This will allow deployment of larger stacks.

Proposed solution

Add an option on CDK Synth that will strip out all white spaces from the output template JSON (in my use case this reduced the size from 500k to 250k).

Possibly this could be an option for cdk.json

Other

Using Nested Stacks is the most common way to reduce stack size, in my use case I was doing a lot of with Cross Account CodePipelines which created many permissions objects and was very sensitive to repacking in nested stacks.

  • 👋 I may be able to implement this feature request
  • ⚠️ This feature might incur a breaking change

This is a 🚀 Feature Request

Metadata

Metadata

Assignees

Labels

feature-requestA feature should be added or improved.needs-triageThis issue or PR still needs to be triaged.package/toolsRelated to AWS CDK Tools or CLI

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions