Installing CloudCustodian for AWS

Cloud Custodian is a rules engine for AWS fleet management. It allows users to define policies to enable a well managed cloud infrastructure, that's both secure and cost optimized. It consolidates many of the adhoc scripts organizations have into a lightweight and flexible tool, with unified metrics and reporting.

Why this post?
Cloud Custodian installation instructions from their Github page simply tell you following commands which did not work for me.

$ virtualenv --python=python2 custodian
$ source custodian/bin/activate
  (custodian) $ pip install c7n

Hence i noted down a more comprehensive installation instructions that worked.


Assumptions.
Python is already installed which includes a pip version installed as well. But we need to upgrade pip first.

Installation instructions with failed commands and fixed actions.

1. Install homebrew
$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

2. Update PIP
$ brew install pip (Didn't work)
$ brew upgrade pip (Didn’t work)

(Brew didn't work out in this case but it's good to have it installed anyway)

$ curl https://bootstrap.pypa.io/get-pip.py | python (Gave error. Requires sudo su.)
$ sudo su
# curl https://bootstrap.pypa.io/get-pip.py | python

3. Install virtualenv
$ pip install virtualenv

4. Install cloudcustodian in the virtualenv

$ virtualenv —python=python2 custodian (Error! Requires python exact version.)
$ virtualenv —python=python2.7 custodian
$ source custodian/bin/activate
(custodian) $ pip install c7n

5. Running a cloudcustodian command
$ custodian run -s out policy.yml

Popular posts from this blog

Installing Python Boto3 for AWS on MacOS