forked from davidclin/cloudcustodian-policies
-
Notifications
You must be signed in to change notification settings - Fork 0
/
cheatsheet.txt
80 lines (63 loc) · 3.27 KB
/
cheatsheet.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
============================
c7n-mailer Developer Install
============================
$ git clone https://github.com/capitalone/cloud-custodian
$ cd cloud-custodian
$ virtualenv c7n_mailer
$ source c7n_mailer/bin/activate
$ cd tools/c7n_mailer
$ pip install -r requirements.txt
$ python setup.py develop
===================
Invoking c7n Mailer
===================
c7n-mailer --config mailer.yml --update-lambda && custodian run -c test.yml -s .
c7n-mailer --config mailer_iesandbox.yml --update-lambda && custodian run -c test.yml -s .
===============================
Finding Default Email Templates
===============================
find ~/ -type f -name "default.html.j2"
find ~/ -type f -name "slack_default.j2"
==============================
Clearing Cloud Custodian Cache
==============================
$ custodian run --help
$ rm ~/.cache/cloud-custodian.cache
==============================
Getting Jenkins Version Number
==============================
java -jar jenkins-cli.jar -s http://localhost:8080/ version
=====================================================
Extracting Email Message Variable Names in Mailer SQS
=====================================================
Copy the encoded SQS message into a file (e.g. result)
Decode the text using:
$ cat result | base64 -d > result.zlib
$ printf "\x1f\x8b\x08\x00\x00\x00\x00\x00" | cat - result.zlib | gzip -dc
The printf is just to pad a proper header for gzip. Otherwise gzip will not be able to uncompress it.
========================================
Cloning a Development Branch for Testing
========================================
git clone -b mailer-test https://github.com/LykinsN/cloud-custodian.git
===================
Useful Git Commands
===================
git clone -b mailer-test https://github.com/LykinsN/cloud-custodian.git
git pull (from directory branch was cloned)
git branch -a (to view branch info)
=======================================
AWS CLI to Create Dummy Security Groups
=======================================
Create security groups in David's VPC Sandbox
export AWS_PROFILE=sandbox
aws ec2 create-security-group --group-name launch-wizard-10 --description "david.lin security group" --vpc-id vpc-2ea22555
aws ec2 create-security-group --group-name launch-wizard-11 --description "david.lin security group" --vpc-id vpc-2ea22555
aws ec2 create-security-group --group-name launch-wizard-12 --description "david.lin security group" --vpc-id vpc-2ea22555
aws ec2 create-security-group --group-name launch-wizard-13 --description "david.lin security group" --vpc-id vpc-2ea22555
aws ec2 create-security-group --group-name launch-wizard-14 --description "david.lin security group" --vpc-id vpc-2ea22555
aws ec2 create-security-group --group-name launch-wizard-15 --description "david.lin security group" --vpc-id vpc-2ea22555
================
Custom Reporting
================
$ custodian report --format grid -s output public-instance-whitelist.yml --field KeyName=KeyName --field PublicIpAddress=PublicIpAddress --no-default-fields --field InstanceId=InstanceI d --field VpcId=VpcId --field tag:SubnetId=SubnetId
$ custodian report -s output --no-default-fields --format grid --field InstanceId=InstanceId --field tag:Name=tag:Name --field InstanceType=InstanceType --field VpcId=VpcId --field tag: State=State.Name stopped.yml