aws / aws-cdk

The AWS Cloud Development Kit is a framework for defining cloud infrastructure in code
https://aws.amazon.com/cdk
Apache License 2.0
11.71k stars 3.94k forks source link

(aws-cdk): CDK 2.79.0 size above 300 MB #25588

Open ermanno opened 1 year ago

ermanno commented 1 year ago

Describe the bug

The Python CDK 2.79.0 package is above 300 MB. From past interactions we were informed that this should have been caused by a bug introduced in 2.73.0 which would have been fixed in more current versions. This is an issue for our use case (use CDKv2 from a lambda layer, which has a 265 MB size limit).

Expected Behavior

The CDKv2 size should be around 100 MB like in versions prior to 2.73.0.

Current Behavior

The latest CDKv2 version (2.79.0)'s size is above 300 MB.

Reproduction Steps

Possible Solution

No response

Additional Information/Context

This is a problem for us because we plan use it from a Lambda layer and there we have a 256 MB size limit.

CDK CLI Version

2.79.0

Framework Version

No response

Node.js Version

20

OS

Mac

Language

Python

Language Version

No response

Other information

No response

pahud commented 1 year ago

Thank you for your report. Will bring this up to the team for review.

peterwoodworth commented 1 year ago

Might be related https://github.com/aws/jsii/issues/4066

mrgrain commented 1 year ago

Might be related aws/jsii#4066

It's certainly a contributing factor.

tgmedia-nz commented 1 year ago

We face the same problem, and I can see that the following modules are also massive, and I can't see the need for them:

29592 asset_awscli_v1 49664 asset_kubectl_v20

With quicksight, I've removed it from the import in init.py and done a rm -rf aws_quicksight, but it still leaves the aws-cdk-lib module at around 171MB - yikes.

Ideas how to remove those above?

tgmedia-nz commented 1 year ago

@ermanno - did you find a solution?

ermanno commented 1 year ago

@tgmedia-nz Unfortunately, no. For the moment we are using an older version which didn't have this problem, but of course going forward we will need to be able to update this dependency.

tgmedia-nz commented 1 year ago

Hi @pahud - sorry to raise this again but would someone be able to point into the right direction on how to remove the dependency of asset_awscli_v1 and asset_kubectl_v20?

tgmedia-nz commented 1 year ago

Any help please?

tgmedia-nz commented 3 weeks ago

Just in case anyone else comes across this - we've shifted to use CDK v2 via CodeBuild where we have a ecr repo with pre-built CDK and all requirements installed, then just calling CB via event bridge.