-1

I am using aws-nuke to prune resources in our sandbox account. I would like to only delete resources that are more than 7 days old.

I have tried the following

accounts:
  ************:
    filters:
      EC2Instance:
      - property: dateOlderThan
        value: "time.Now().AddDate(0, 0, -7)"

I have also tried subtracting one day.

accounts:
  ************:
    filters:
      EC2Instance:
      - property: dateOlderThan
        value: "time.Now().AddDate(0, 0, -1)"

I have also tried subtracting 27 years.

accounts:
  ************:
    filters:
      EC2Instance:
      - property: dateOlderThan
        value: "time.Now().AddDate(0, 0, -10000)"

All return the same results,

Scan complete: x total, x nukeable, 0 filtered.

This suggests that the date calculation is being ignored.

How do I give it the current date minus 7 days?

Adrian
  • 42,911
  • 6
  • 107
  • 99
James Geddes
  • 742
  • 3
  • 10
  • 35

1 Answers1

0

According to aws-nuke#756, you can either,

  • specify the date in hours: 168h
  • specify -7d
James Geddes
  • 742
  • 3
  • 10
  • 35