I am new to Cloud Custodian. I’ve generated various policies to cleanup AWS resources. I would like to take the policy output and generate a report per Cloud Custodian documentation here for our SREs. However, Cloud Custodian report cannot find any records/resources when using the same policy file. I’m running Cloud Custodian v0.9.36 in a docker container with AWS credentials configured.
When I run test policy to query EC2 instances, I receive records as expected. When I run Cloud Custodian report, no resources are found. Report folders are created per policy and are empty. Raw output file is empty as well. See output below:
custodian@27c49e174cab:~$ custodian run -s output --cache-period 0 policies/test.yml
2024-05-30 14:31:08,835: custodian.policy:INFO policy:ec2-report-all resource:ec2 region:us-west-1 count:14 time:1.72
2024-05-30 14:31:10,507: custodian.policy:INFO policy:ec2-report-running resource:ec2 region:us-west-1 count:12 time:1.67
2024-05-30 14:31:12,124: custodian.policy:INFO policy:ec2-report-stopped resource:ec2 region:us-west-1 count:2 time:1.61
custodian@27c49e174cab:~$ custodian report -s ./reports --raw ./test.json --format grid -v --all-findings policies/test.yml
2024-05-30 14:31:18,646: custodian.cache:DEBUG Disabling cache
2024-05-30 14:31:18,647: custodian.commands:DEBUG Loaded file policies/test.yml. Contains 3 policies
2024-05-30 14:31:18,652: custodian.aws:DEBUG using default region:us-west-1 from boto
2024-05-30 14:31:19,217: custodian.reports:DEBUG Found 0 records for region us-west-1
2024-05-30 14:31:19,218: custodian.reports:DEBUG Found 0 records for region us-west-1
2024-05-30 14:31:19,218: custodian.reports:DEBUG Found 0 records for region us-west-1
+-----------------+--------------+------------+----------------+--------------+---------+--------------------+----------+
| CustodianDate | InstanceId | tag:Name | InstanceType | LaunchTime | VpcId | PrivateIpAddress | Policy |
+=================+==============+============+================+==============+=========+====================+==========+
+-----------------+--------------+------------+----------------+--------------+---------+--------------------+----------+
test.yml policy file content:
policies:
# EC2 Reporting Policies
- name: ec2-report-all
resource: ec2
comments: |
Report all stand-alone EC2 instances.
filters: []
- name: ec2-report-running
resource: ec2
comments: |
Report all running stand-alone EC2 instances.
filters:
- "State.Name": running
- name: ec2-report-stopped
resource: ec2
comments: |
Report all stopped stand-alone EC2 instances.
filters:
- "State.Name": stopped
I’m not sure if this a new bug with Cloud Custodian or if there is another undocumented configuration I need to run the report and successfully pull records.