ekristen / aws-nuke

Remove all the resources from an AWS account
https://ekristen.github.io/aws-nuke/
MIT License
32 stars 6 forks source link

dateOlderThan usage #204

Open YuriGal opened 1 week ago

YuriGal commented 1 week ago

dateOlderThan is such a cool new filter, thanks for adding it! We were trying to use the nuke to delete older stale resources, and this is what the doctor ordered.

I have couple questions:

  1. Is there a way to find out which resource exposes which date property? E.g. for CloudFormationStack it's LastUpdatedTime, for IAMRole it's LastUsedDate etc. We're looking for some universal way to say "resource is older than."
  2. if dateOlderThan filter is used, but property it targets doesn't exist, null, or contains non-date value - will it be skipped or nuked?
  3. Would be great to see actual example of dateOlderThan filter being used in a config.

Thanks!

ekristen commented 1 week ago

Is there a way to find out which resource exposes which date property?

Not yet but coming soon! I'm working on making all the properties programmatically discoverable so that I can automatically generate documentation and also have a subcommand to ask what properties are available potentially. I unfortunately do not have an ETA, it's a fairly large change, will probably show up in a next tag or branch when it does.

if dateOlderThan filter is used, but property it targets doesn't exist, null, or contains non-date value - will it be skipped or nuked?

Filtering is based on matches, unless you use the invert method, so basically if you filter on a property doesnotexist with a value of here because the property doesn't exist the filter has no effect on the outcome, so unless another filter matches, it would still be included for removal.

Would be great to see actual example of dateOlderThan filter being used in a config.

I can do that. I have an AMI example laying around somewhere on my system I think, I'll try and dig it up.