question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Garbage Collection for Assets

See original GitHub issue

Description

Assets which are uploaded to the CDK’s S3 bucket and ECR repository are never deleted. This will incur costs for users in the long term. We should come up with a story on how those should be garbage collected safely.

Initially we should offer cdk gc which will track down unused assets (e.g. by tracing them back from deployed stacks) and offering users to delete them. We can offer an option to automatically run this after every deployment (either in CLI or through CI/CD). Later we can even offer a construct that you deploy to your environment and it can do that for you.

Proposed usage:

cdk gc [ENVIRONMENT...] [--list] [--type=s3|ecr]

Examples:

This command will find all orphaned S3 and ECR assets in a specific AWS environment and will delete them:

cdk gc aws://ACCOUNT/REGION

This command will garbage collect all assets in all environments that belong to the current CDK app (if cdk.json exists):

cdk gc

Just list orphaned assets:

cdk gc --list

Roles

Role User
Proposed by @eladb
Author(s) @kaizen3031593
API Bar Raiser @njlynch
Stakeholders @rix0rrr @nija-at

See RFC Process for details

Workflow

  • Tracking issue created (label: status/proposed)
  • API bar raiser assigned (ping us at #aws-cdk-rfcs if needed)
  • Kick off meeting
  • RFC pull request submitted (label: status/review)
  • Community reach out (via Slack and/or Twitter)
  • API signed-off (label api-approved applied to pull request)
  • Final comments period (label: status/final-comments-period)
  • Approved and merged (label: status/approved)
  • Execution plan submitted (label: status/planning)
  • Plan approved and merged (label: status/implementing)
  • Implementation complete (label: status/done)

Author is responsible to progress the RFC according to this checklist, and apply the relevant labels to this issue so that the RFC table in README gets updated.

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:137
  • Comments:24 (5 by maintainers)

github_iconTop GitHub Comments

8reactions
jogoldcommented, Feb 1, 2022

See https://github.com/jogold/cloudstructs/blob/master/src/toolkit-cleaner/README.md for a working construct that does asset garbage collection.

7reactions
rehanvdmcommented, Aug 12, 2021

We are approaching 0.5TB of assets in the staging bucket. I can only imagine how much large companies have 😦

Read more comments on GitHub >

github_iconTop Results From Across the Web

Garbage Collection, Allocations, and Third Party Assets in the ...
Garbage Collection, Allocations, and Third Party Assets in the Asset ... Value types are subject to garbage collection when used in classes
Read more >
Garbage collector overview - Unity - Manual
Unity uses a garbage collector to reclaim memory from objects that your application and Unity are no longer using. When a script tries...
Read more >
Ensuring Efficient Waste Collections with Asset Management ...
The answer is because the collection process has to be planned well and data tracking and monitoring is very important. We can observe...
Read more >
Trash Kit - Most Complete Collection of 3D Trash Assets Ever!
... complete collection of trash assets Trash Kit: https://blendermarket.com/products/trashkit---3d-assetkit?ref=110Muscles and Joint Add...
Read more >
Asset Pricing with Garbage - NYU Stern
A garbage-based consumption capital asset pricing model ... addition, the European data are collected by sampling waste sites. I keep all.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found