Skip to content

Instantly share code, notes, and snippets.

View kapilt's full-sized avatar
🌩️
🌩 📦 🔭 📻 🚀 🛰

Kapil Thangavelu kapilt

🌩️
🌩 📦 🔭 📻 🚀 🛰
View GitHub Profile
# pip install c7n
# pip install fastjsonschema
import time
import yaml
from c7n.resources import load_resources
from c7n.schema import specific_error, generate
import fastjsonschema
# output of make install &> out.txt
python3 -m venv .
. bin/activate && pip install -r requirements-dev.txt
Obtaining file:///Users/kapilt/projects/test-c7n/cloud-custodian/tools/c7n_mailer (from -r requirements-dev.txt (line 28))
Obtaining file:///Users/kapilt/projects/test-c7n/cloud-custodian/tools/c7n_azure (from -r requirements-dev.txt (line 30))
Obtaining file:///Users/kapilt/projects/test-c7n/cloud-custodian/tools/c7n_gcp (from -r requirements-dev.txt (line 32))
Obtaining file:///Users/kapilt/projects/test-c7n/cloud-custodian/tools/c7n_kube (from -r requirements-dev.txt (line 34))
Obtaining file:///Users/kapilt/projects/test-c7n/cloud-custodian/tools/c7n_org (from -r requirements-dev.txt (line 36))
Collecting argcomplete>=1.8.2 (from -r requirements.txt (line 1))
Using cached https://files.pythonhosted.org/packages/4d/82/f44c9661e479207348a979b1f6f063625d11dc4ca6256af053719bbb0124/argcomplete-1.10.0-py2.py3-none-any.whl

0.8.45.0 Release Notes

Compatibility Warning

A bug fix (#4277) around custodian schema validation of boolean filter blocks (or, and, and not) may now cause some validation errors on invalid policies. Previously these policies would have passed validation as it was not performed recursively on boolean blocks. Please check your policies with the latest release.

aws

  • aws - handle missing ec2 launch template (#4579)
import sys
import json
from c7n.config import Config
from c7n.resources import load_resources
from c7n.policy import load
def main():
if not len(sys.argv) == 3:
print('usage policy.yml permissions.json')
import boto3
import random
def getconfig(key):
return {
'api-delay-services': ['ec2'],
'api-delay-range': [0, 3],
'api-delay-rate': 10,
'aws-fault-services': ['s3', 'dynamodb'],
'api-fault-rate': 10
policies:
- name: SendNotification
resource: aws.ecr
mode:
type: cloudtrail
environment:
Variables:
C7N_SKIP_EVTERR: no
role: Jak-cloud-custodian-role
events:
@kapilt
kapilt / Makefile
Last active May 26, 2019 11:34
chalice terraform
up-chalice:
time chalice deploy
down-chalice:
time chalice delete
up-terraform:
time chalice package --pkg-format=terraform pkg
cd pkg && time terraform apply -auto-approve
@kapilt
kapilt / clirun.py
Created May 7, 2019 18:05
aws-terminator cli runner
"""
a simple front end for to terminator for checking in isolation.
"""
import logging
import boto3
import click
from terminator import (
cleanup, get_concrete_subclasses, kvs, Terminator, process_instance)
$ python s3.py
jsii.errors.JavaScriptError:
Error: No stack could be identified for the construct at path
at _lookStackUp (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_modules/@aws-cdk/cdk/lib/construct.js:67:23)
at ConstructNode.get stack [as stack] (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_modules/@aws-cdk/cdk/lib/construct.js:61:46)
at _lookStackUp (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_modules/@aws-cdk/cdk/lib/construct.js:69:37)
at ConstructNode.get stack [as stack] (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_modules/@aws-cdk/cdk/lib/construct.js:61:46)
at _lookStackUp (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_modules/@aws-cdk/cdk/lib/construct.js:69:37)
at ConstructNode.get stack [as stack] (/private/var/folders/m0/9m4c62yx3sd12290vsfcc14m0000gn/T/jsii-kernel-xHy1sY/node_

Keybase proof

I hereby claim:

  • I am kapilt on github.
  • I am kapilt (https://keybase.io/kapilt) on keybase.
  • I have a public key ASC8ksFDb5vcwt3JbTR9L_7coVTMMy2f2iqrv9O6bJ4Orgo

To claim this, I am signing this object: