This script is intended to serve as one piece of the puzzle when building out IAM roles that will execute Cloud Custodian policies.
In the best case, the output of the script can be combined with the base IAM setup information in the official documentation.
This still may not cover all required permissions. For example:
- Permission annotations in Cloud Custodian resources, filters or actions may be incomplete.
- This static scan of policies cannot account for all possible triggering mechanisms or AssumeRole operations.
Still, it's a useful starting point.
As this script is performing policy validations and permission checks using Cloud Custodian modules, it must be executed from a Python environment where Cloud Custodian is already installed.
From there, run:
python /path/to/get_c7n_iam_actions.py -p <policy file/directory>
Or for more information:
python /path/to/get_c7n_iam_actions.py --help
Very useful, thank you!