Skip to main content

License

Cloud Custodian

Cloud Custodian is a rules engine for AWS resource management. It allows users to define policies to be enforced to enable a well managed cloud, with metrics and structured outputs. It consolidates many of the adhoc scripts organizations have into a lightweight and flexible tool.

Organizations can use Custodian to manage their AWS environments by ensuring compliance to security policies, tag policies, garbage collection of unused resources, and cost management via off-hours resource management.

Custodian policies are written in simple YAML configuration files that specify given a resource type (ec2, asg, redshift, etc) and are constructed from a vocabulary of filters and actions. Custodian was created to unify the dozens of tools and scripts most organizations use for managing their AWS accounts into one open source tool and provide unified operations and reporting.

It integrates with lambda and cloudwatch events to provide for realtime enforcement of policies with builtin provisioning, or can isomorphically be used to query and operate against all of account resources.

Usage

First a policy file needs to be created in yaml format, as an example:

policies:
 - name: remediate-extant-keys
   description: |
     Scan through all s3 buckets in an account and ensure all objects
     are encrypted (default to AES256).
   resources: s3
   actions:
     - encrypt-keys

 - name: ec2-require-non-public-and-encrypted-volumes
   resource: ec2
   description: |
     Provision a lambda and cloud watch event target
     that looks at all new instances not in an autoscale group
     and terminates those with unencrypted volumes.
   mode:
     type: cloudtrail
     events:
      - RunInstances
   filters:
     - Encrypted: false
   actions:
     - terminate

 - name: tag-compliance
   resources: ec2
   description:
     Schedule a resource that does not meet tag compliance policies
     to be stopped in four days.
   filters:
     - State.Name: running
     - "tag:Environment": absent
     - "tag:AppId": absent
     - or:
       - "tag:OwnerContact": absent
       - "tag:DeptID": absent
   actions:
     - type: mark-for-op
       op: stop
       days: 4

Given that, you can run cloud-custodian

# Directory for outputs
$ mkdir out

# Validate the configuration
$ custodian validate -c policy.yml

# Dryrun on the policies (no actions executed)
$ custodian run --dryrun -c policy.yml -s out

# Run the policy
$ custodian run -c policy.yml -s out

Maid supports a few other useful subcommands and options, including outputs to s3, cloud watch metrics, sts role assumption.

Consult the documentation for additional information.

Get Involved

Mailing List - https://groups.google.com/forum/#!forum/cloud-custodian

Irc - #cloud-custodian on irc.freenode.net

Contributors :

We welcome Your interest in Capital One’s Open Source Projects (the “Project”). Any Contributor to the Project must accept and sign an Agreement indicating agreement to the license terms below. Except for the license granted in this Agreement to Capital One and to recipients of software distributed by Capital One, You reserve all right, title, and interest in and to Your Contributions; this Agreement does not impact Your rights to use Your own Contributions for any other purpose

Metadata

Release files for c7n 0.8.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for c7n 0.8.2
File Size Uploaded Provenance Actions
c7n-0.8.2.tar.gz 69.8 kB Without provenance Details for c7n-0.8.2.tar.gz

Release files / c7n-0.8.2.tar.gz

Download URL c7n-0.8.2.tar.gz
Size 69.8 kB
Tags Source
SHA-256 checksum
How to use checksums
2297126a81fab6f96400197f4192ef5474e8f771ebf280ed69a9d41cc7eef740
BLAKE2b-256 checksum
How to use checksums
29810f3e1b5cec7ff30c2758af6a21ab558e6344502e42f2a3b7b72faedfd70f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for c7n 0.8.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

0.8.12

0.8.6

This release

0.8.2 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page