Skip to main content

c7n policy generation script and related utilities

Project description

[![ReadTheDocs.org build status](https://readthedocs.org/projects/manheim-c7n-tools/badge/?version=latest)](https://manheim-c7n-tools.readthedocs.io/)

[![TravisCI build badge](https://api.travis-ci.org/manheim/manheim-c7n-tools.png?branch=master)](https://travis-ci.org/manheim/manheim-c7n-tools)

[![Docker Hub Build Status](https://img.shields.io/docker/cloud/build/manheim/manheim-c7n-tools.svg)](https://hub.docker.com/r/manheim/manheim-c7n-tools)

Manheim’s Cloud Custodian (c7n) wrapper package, policy generator, runner, and supporting tools.

This project provides common tooling, distributed as a Docker image, for managing Manheim’s cloud-custodian (c7n) tooling, including c7n itself, c7n_mailer, and our custom components. This project/repository is intended to be used (generally via the generated Docker image) alongside a configuration repository of a specific layout, containing configuration for one or more AWS accounts.

For documentation on the upstream cloud-custodian project, please see <https://cloudcustodian.io/docs/index.html> and the source code at <https://github.com/cloud-custodian/cloud-custodian>.

Introduction and Goals

Cloud Custodian (a.k.a. c7n) is a flexible rules engine for reporting on and enforcing policy in AWS. Manheim has migrated from Netflix Janitor Monkey to Cloud Custodian for our tag enforcement, resource cleanup, cost reduction, and other policy needs. This project provides common tooling to allow us to deploy and manage c7n across multiple AWS accounts.

We’re currently deploying all Cloud Custodian policies via AWS Lambda. The default is to run policies once per day, but other execution triggers are available including arbitrary timer triggers as well as CloudTrail, AWS Config and CloudWatch Events.

A description of the initial tooling that turned into this project can be found in [this blog post](https://blog.jasonantman.com/2017/10/cloud-custodian-architecture-deployment-and-policy-preprocessing/).

Main Components

The following commands are available in the Docker container (or Python installation), generated as Python package entrypoints:

  • [manheim-c7n-runner](https://manheim-c7n-tools.readthedocs.io/en/latest/runner/) - A single entrypoint to wrap running one or more, or all, of the following steps (as well as custodian itself, c7n-mailer deploy, and Sphinx documentation build) in the proper order, in either run (real) or dryrun mode.

  • [policygen](https://manheim-c7n-tools.readthedocs.io/en/latest/policygen/) - The python script to generate the actual custodian YML config files from a configuration repo/directory. Must be run from a config repository directory.

  • [s3-archiver](https://manheim-c7n-tools.readthedocs.io/en/latest/s3archiver/) - Script to clean up custodian S3 buckets by moving logs from any deleted policies to an “archived-logs/” prefix.

  • [dryrun-diff](https://manheim-c7n-tools.readthedocs.io/en/latest/dryrun-diff/) - Script to compare the number of resources matched per-policy, per-region between a dryrun and the last actual run of each policy, and write the results to a Markdown file (to be added as a comment on the PR).

  • errorscan - Script using boto3 to examine CloudWatch Metrics, Logs, and SQS Dead Letter Queue for cloud-custodian Lambda functions, and alert on any failed executions, dead letters, etc.

  • c7n’s built-in mugc Lambda garbage collection. This is vendored-in to manheim-c7n-tools, as c7n provides it only as a non-executable Python source file in their git repo.

  • c7n’s c7n-mailer installed as a dependency for convenience.

Installation and Usage

See [Installation and Usage](https://manheim-c7n-tools.readthedocs.io/en/latest/usage/)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

manheim-c7n-tools-0.7.0.tar.gz (51.3 kB view details)

Uploaded Source

Built Distribution

manheim_c7n_tools-0.7.0-py2.py3-none-any.whl (63.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file manheim-c7n-tools-0.7.0.tar.gz.

File metadata

  • Download URL: manheim-c7n-tools-0.7.0.tar.gz
  • Upload date:
  • Size: 51.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for manheim-c7n-tools-0.7.0.tar.gz
Algorithm Hash digest
SHA256 ea75242b8fe7238901478ec699e8d5ba5f8b10db153275f31a231938dd43abde
MD5 633d4d5514ad090c67e0c383956455b4
BLAKE2b-256 45b0d960801afb3f7022c83388095532f13667c1d3971388891e86803758e6b5

See more details on using hashes here.

File details

Details for the file manheim_c7n_tools-0.7.0-py2.py3-none-any.whl.

File metadata

  • Download URL: manheim_c7n_tools-0.7.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 63.3 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.32.2 CPython/3.7.1

File hashes

Hashes for manheim_c7n_tools-0.7.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 7270ec09aea647ba09c75d904e2c5a07e6b934381a2c3fa3da57fa0847df0563
MD5 40b6f5a217a396205a031b370e461eb6
BLAKE2b-256 d2b840438d2af2640529ff78a7f2154dc02dd9ed699fc324fdba31488168829d

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page