- Comprehensive support for AWS services and resources (> 100), along with 400+ actions and 300+ filters to build policies with.
- Supports arbitrary filtering on resources with nested boolean conditions.
- Dry run any policy to see what it would do.
- Automatically provisions AWS Lambda functions, AWS Config rules, and Cloudwatch event targets for real-time policies.
- AWS Cloudwatch metrics outputs on resources that matched a policy
- Structured outputs into S3 of which resources matched a policy.
- Intelligent cache usage to minimize api calls.
- Battle-tested – in production on some very large AWS accounts.
- Supports cross-account usage via STS role assumption.
- Supports integration with custom/user supplied Lambdas as actions.
- Supports both Python 2.7 and Python 3.6 (beta) Lambda runtimes
$ virtualenv --python=python2 custodian
$ source custodian/bin/activate
(custodian) $ pip install c7n
- name: remediate-extant-keys
Scan through all s3 buckets in an account and ensure all objects
are encrypted (default to AES256).
- name: ec2-require-non-public-and-encrypted-volumes
Provision a lambda and cloud watch event target
that looks at all new instances and terminates those with
- type: ebs
- name: tag-compliance
Schedule a resource that does not meet tag compliance policies
to be stopped in four days.
- State.Name: running
- "tag:Environment": absent
- "tag:AppId": absent
- "tag:OwnerContact": absent
- "tag:DeptID": absent
- type: mark-for-op
Given that, you can run Cloud Custodian with:
# Validate the configuration (note this happens by default on run)
$ custodian validate policy.yml
# Dryrun on the policies (no actions executed) to see what resources
# match each policy.
$ custodian run --dryrun -s out policy.yml
# Run the policy
$ custodian run -s out policy.yml
Custodian supports a few other useful subcommands and options, including outputs to S3, Cloudwatch metrics, STS role assumption. Policies go together like Lego bricks with actions and filters.
Consult the documentation for additional information, or reach out on gitter.
Mailing List – https://groups.google.com/forum/#!forum/cloud-custodian
Gitter – https://gitter.im/capitalone/cloud-custodian
The Custodian project also develops and maintains a suite of additional tools here https://github.com/capitalone/cloud-custodian/tree/master/tools:
- Scale out s3 scanning.
- A reference implementation of sending messages to users to notify them.
- Cloudtrail indexing and timeseries generation for dashboarding
- Cloud watch log exporting to s3
- Indexing of custodian metrics and outputs for dashboarding
- Log parsing for python tracebacks to integrate with https://sentry.io/welcome/