c7n-org is a command-line tool designed to execute Cloud Custodian policies across multiple cloud accounts (AWS, Azure, GCP, OCI) in parallel. It centralizes policy definition and enforcement for large cloud environments, simplifying governance and compliance at scale. The current version is 0.6.49, and it is regularly updated in conjunction with the main Cloud Custodian project.
pip install c7n-orgNo compatibility data collected yet for this library.
c7n-org operates via the command line, requiring an `accounts.yml` file that defines the target cloud accounts and regions, and Custodian policy files (e.g., `policy.yml`). This example demonstrates setting up these files and shows the command to run `c7n-org` to execute policies across multiple accounts and regions. For AWS, the `accounts.yml` can be dynamically generated using `c7n-org aws-accounts -f accounts.yml` if AWS Organizations is configured.
Ensure your environment uses Python >=3.9.2 and <4.0.0. Upgrade Python if necessary.
Verify that the IAM role specified in `accounts.yml` exists in each target account and grants sufficient permissions for `c7n-org` to assume it and execute policies.
Before generating a report, ensure that the policy execution output is synced or copied to a local directory accessible to the `c7n-org report` command.
Increase logging verbosity where possible (e.g., `-v` flag if available), and consult underlying cloud provider logs (CloudTrail, CloudWatch Logs) for more detailed error information. Consider raising an issue for improved logging if specific gaps are identified.
Ensure the AWS CLI and Boto3 configurations properly handle regional STS endpoints. If issues persist, consider explicit region configurations in `accounts.yml` or check for updates to `c7n-org`.
Ensure your AWS credentials are configured correctly, for example, by setting the AWS_PROFILE environment variable, configuring `~/.aws/credentials` and `~/.aws/config`, or ensuring the IAM role specified in `accounts.yml` has the necessary permissions and can be assumed by c7n-org. You might need to use `export AWS_PROFILE=your_profile_name` or define the `role` in your `accounts.yml`.
Reduce the `max_workers` value in your c7n-org command (e.g., `--max-workers N`) or configuration file to a number less than or equal to the indicated limit (X), often around 61 on Windows. The default is usually sufficient.
Upgrade both `c7n` and `c7n-org` to their latest compatible versions using `pip install --upgrade c7n c7n-org`. If the issue persists, consider creating a clean Python virtual environment and reinstalling the libraries.
Verify that the IAM role specified in your `c7n-org` configuration (the role that `c7n-org` assumes in the target accounts) has a trust policy allowing the managing account's principal (user or role) to assume it. Also, ensure the managing account's execution role has `sts:AssumeRole` permissions for the target account's role.