AWS Introduces CDK Garbage Collection
Briefly

Amazon has introduced a preview of a garbage collection feature in AWS CDK, designed to help developers manage and delete outdated assets in S3 buckets and ECR repositories. The new command, cdk gc, enables users to observe, manage, and eliminate unused resources, thereby reducing maintenance and deployment costs. This feature was driven by requests from the development community, aiming to tackle issues of disk space consumption, particularly in the cdk.out directory. Although currently in preview, the command’s capabilities may evolve as development continues.
For CDK developers that leverage assets at scale, they may notice over time that the bootstrapped bucket or repository accumulated old or unused data. If users wanted to clean this data on their own, CDK didn't provide a clear way of determining which data is safe to delete.
We expect CDK Garbage Collection to help AWS CDK customers save on storage costs associated with using the product while not affecting how customers use CDK.
Each cdk build creates a new assets folder under cdk.out. If this includes node_modules, the total size of the cdk.out folder can add up pretty quickly (mine was over 10Gb)!
The cdk gc command is still in development and preview mode, and while the current features of this command are considered production-ready and safe to use, the scope of the command and its features might be subject to change.
Read at InfoQ
[
|
]