I have a policy that removes AMIs after X number of days. Before I ran it, I wanted to do a dry run to make sure the proper AMIs were going to be removed but the --dryrun option only shows the count. It would be nice to also print each resource's information that it plans to remove.
Perhaps it could be an additional option that can be used in tandem with --dryrun such as --dryrun -v or something similar.
use report subcommand if you want cli output on the resources that match a policy. Policies may be executed against 10s of thousands, or even millions of resources. We defer any per resource output to an explicit report command instead of trying to mix its output into run. you can display custom fields with report using the --field option.
@kapilt ah I see. I run the following but I don't see any output.
$ custodian report -s . temp.yml --region us-east-1
ImageId,Name,CreationDate
I checked the output in my current directory but no output files exist. Am I doing something wrong?
you have to give the same output directory you did for the run. these types of questions are probably better for the gitter channel.
(custodian) kapilt@realms-scythe ~/p/custodian> custodian run -c ami.yml -s out2 --dryrun
2019-02-28 08:46:28,653: custodian.policy:INFO policy: ami resource:ami region:us-east-1 count:1 time:0.44
(custodian) kapilt@realms-scythe ~/p/custodian> ls out2/ami/
custodian-run.log metadata.json resources.json
(custodian) kapilt@realms-scythe ~/p/custodian> custodian report -c ami.yml -s out2
ImageId,Name,CreationDate
ami-0515ff4f8f9dbeb31,Ubuntu1404,2018-11-04T06:24:45.000Z