Skip to content

Commit f747248

Browse files
committed
Merge pull request #6 from irlrobot/even_more_services
adds config_rule and cloudwatch_events services 💣
2 parents 3c5b5b9 + 22a1c33 commit f747248

5 files changed

Lines changed: 214 additions & 2 deletions

File tree

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ pprint(codepipeline.event)
2424
* s3_put
2525
* s3_delete
2626
* cloudwatch_logs
27+
* cloudwatch_events
28+
* config_rule
2729

2830
# References
2931
[AWS Lambda Event Sources](http://docs.aws.amazon.com/lambda/latest/dg/eventsources.html)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
{
2+
"account": "123456789000",
3+
"region": "us-east-1",
4+
"detail": {
5+
"state": "terminated",
6+
"instance-id": "i-99999999"
7+
},
8+
"detail-type": "EC2 Instance State-change Notification",
9+
"source": "aws.ec2",
10+
"version": "0",
11+
"time": "2016-01-01T00:00:00",
12+
"id": "f4e480cb-307b-46ed-b290-07a047534ac1",
13+
"resources": ["arn:aws:ec2:us-east-1:123456789000:instance/i-99999999"]
14+
}
Lines changed: 192 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,192 @@
1+
{
2+
"configRuleId": "config-rule-lrmtsa",
3+
"version": "1.0",
4+
"configRuleName": "test",
5+
"configRuleArn": "arn:aws:config:us-east-1:123456789000:config-rule/config-rule-lrmtsa",
6+
"invokingEvent": {
7+
"configurationItemDiff": null,
8+
"configurationItem": {
9+
"configurationItemVersion": "1.1",
10+
"relatedEvents": [
11+
"a3336d74-15a5-48c9-bd72-b72e544e110a"
12+
],
13+
"tags": {
14+
"aws:cloudformation:stack-name": "awseb-e-fpare4evqj-stack",
15+
"aws:autoscaling:groupName": "awseb-e-fpare4evqj-stack-AWSEBAutoScalingGroup-1PT7D8M0ELAIY",
16+
"aws:cloudformation:stack-id": "arn:aws:cloudformation:us-east-1:123456789000:stack/awseb-e-fpare4evqj-stack/499b0420-871f-11e5-b799-50fa1dbb2c64",
17+
"elasticbeanstalk:environment-name": "test",
18+
"aws:cloudformation:logical-id": "AWSEBAutoScalingGroup",
19+
"elasticbeanstalk:environment-id": "e-fpare4evqj",
20+
"Name": "test"
21+
},
22+
"relationships": [{
23+
"resourceId": "eni-7755cc55",
24+
"resourceName": null,
25+
"resourceType": "AWS::EC2::NetworkInterface",
26+
"name": "Contains Network Interface"
27+
}, {
28+
"resourceId": "sg-ca9a13ad",
29+
"resourceName": null,
30+
"resourceType": "AWS::EC2::SecurityGroup",
31+
"name": "Is associated with Security Group"
32+
}, {
33+
"resourceId": "subnet-c75c6ced",
34+
"resourceName": null,
35+
"resourceType": "AWS::EC2::Subnet",
36+
"name": "Is contained in Subnet"
37+
}, {
38+
"resourceId": "vol-43ac259d",
39+
"resourceName": null,
40+
"resourceType": "AWS::EC2::Volume",
41+
"name": "Is attached to Volume"
42+
}, {
43+
"resourceId": "vpc-a19f2bcd",
44+
"resourceName": null,
45+
"resourceType": "AWS::EC2::VPC",
46+
"name": "Is contained in Vpc"
47+
}],
48+
"configuration": {
49+
"instanceId": "i-9d8af31e",
50+
"imageId": "ami-5578243f",
51+
"state": {
52+
"code": 16,
53+
"name": "running"
54+
},
55+
"privateDnsName": "ip-172-31-60-10.ec2.internal",
56+
"publicDnsName": "ec2-54-173-142-236.compute-1.amazonaws.com",
57+
"stateTransitionReason": "",
58+
"keyName": "test",
59+
"amiLaunchIndex": 0,
60+
"productCodes": [],
61+
"instanceType": "t2.small",
62+
"launchTime": "2016-02-11T20:42:29.000Z",
63+
"placement": {
64+
"availabilityZone": "us-east-1d",
65+
"groupName": "",
66+
"tenancy": "default",
67+
"hostId": null,
68+
"affinity": null
69+
},
70+
"kernelId": null,
71+
"ramdiskId": null,
72+
"platform": null,
73+
"monitoring": {
74+
"state": "enabled"
75+
},
76+
"subnetId": "subnet-c75c6ced",
77+
"vpcId": "vpc-a19f2bcd",
78+
"privateIpAddress": "172.31.60.10",
79+
"publicIpAddress": "54.173.142.236",
80+
"stateReason": null,
81+
"architecture": "x86_64",
82+
"rootDeviceType": "ebs",
83+
"rootDeviceName": "/dev/xvda",
84+
"blockDeviceMappings": [{
85+
"deviceName": "/dev/xvda",
86+
"ebs": {
87+
"volumeId": "vol-43ac259d",
88+
"status": "attached",
89+
"attachTime": "2016-02-11T20:42:33.000Z",
90+
"deleteOnTermination": true
91+
}
92+
}],
93+
"virtualizationType": "hvm",
94+
"instanceLifecycle": null,
95+
"spotInstanceRequestId": null,
96+
"clientToken": "5e9a9f6f-47fe-4f3e-b083-6b0da395d229_us-east-1d_1",
97+
"tags": [{
98+
"key": "aws:cloudformation:stack-name",
99+
"value": "awseb-e-fpare4evqj-stack"
100+
}, {
101+
"key": "aws:autoscaling:groupName",
102+
"value": "awseb-e-fpare4evqj-stack-AWSEBAutoScalingGroup-1PT7D8M0ELAIY"
103+
}, {
104+
"key": "elasticbeanstalk:environment-id",
105+
"value": "e-fpare4evqj"
106+
}, {
107+
"key": "elasticbeanstalk:environment-name",
108+
"value": "test"
109+
}, {
110+
"key": "aws:cloudformation:logical-id",
111+
"value": "AWSEBAutoScalingGroup"
112+
}, {
113+
"key": "aws:cloudformation:stack-id",
114+
"value": "arn:aws:cloudformation:us-east-1:123456789000:stack/awseb-e-fpare4evqj-stack/499b0420-871f-11e5-b799-50fa1dbb2c64"
115+
}, {
116+
"key": "Name",
117+
"value": "test"
118+
}],
119+
"securityGroups": [{
120+
"groupName": "awseb-e-fpare4evqj-stack-AWSEBSecurityGroup-1NIQ6P36BTNUR",
121+
"groupId": "sg-ca9a13ad"
122+
}],
123+
"sourceDestCheck": true,
124+
"hypervisor": "xen",
125+
"networkInterfaces": [{
126+
"networkInterfaceId": "eni-7755cc55",
127+
"subnetId": "subnet-c75c6ced",
128+
"vpcId": "vpc-a19f2bcd",
129+
"description": "",
130+
"ownerId": "123456789000",
131+
"status": "in-use",
132+
"macAddress": "12:ff:b2:ba:06:55",
133+
"privateIpAddress": "172.31.60.10",
134+
"privateDnsName": "ip-172-31-60-10.ec2.internal",
135+
"sourceDestCheck": true,
136+
"groups": [{
137+
"groupName": "awseb-e-fpare4evqj-stack-AWSEBSecurityGroup-1NIQ6P36BTNUR",
138+
"groupId": "sg-ca9a13ad"
139+
}],
140+
"attachment": {
141+
"attachmentId": "eni-attach-41f0d5a0",
142+
"deviceIndex": 0,
143+
"status": "attached",
144+
"attachTime": "2016-02-11T20:42:29.000Z",
145+
"deleteOnTermination": true
146+
},
147+
"association": {
148+
"publicIp": "54.173.142.236",
149+
"publicDnsName": "ec2-54-173-142-236.compute-1.amazonaws.com",
150+
"ipOwnerId": "amazon"
151+
},
152+
"privateIpAddresses": [{
153+
"privateIpAddress": "172.31.60.10",
154+
"privateDnsName": "ip-172-31-60-10.ec2.internal",
155+
"primary": true,
156+
"association": {
157+
"publicIp": "54.173.142.236",
158+
"publicDnsName": "ec2-54-173-142-236.compute-1.amazonaws.com",
159+
"ipOwnerId": "amazon"
160+
}
161+
}]
162+
}],
163+
"iamInstanceProfile": {
164+
"arn": "arn:aws:iam::123456789000:instance-profile/aws-elasticbeanstalk-ec2-role",
165+
"id": "AIPAJVHIC3NYNK2GWV3XK"
166+
},
167+
"ebsOptimized": false,
168+
"sriovNetSupport": null
169+
},
170+
"configurationItemCaptureTime": "2016-02-11T20:46:47.863Z",
171+
"configurationStateId": 1,
172+
"awsAccountId": "123456789000",
173+
"configurationItemStatus": "ResourceDiscovered",
174+
"resourceType": "AWS::EC2::Instance",
175+
"resourceId": "i-9d8af31e",
176+
"resourceName": null,
177+
"ARN": "arn:aws:ec2:us-east-1:123456789000:instance/i-9d8af31e",
178+
"awsRegion": "us-east-1",
179+
"availabilityZone": "us-east-1d",
180+
"configurationStateMd5Hash": "b748dcf5f848f96efcea6dc5af00cb08",
181+
"resourceCreationTime": "2016-02-11T20:42:29.000Z"
182+
},
183+
"notificationCreationTime": "2016-03-29T02:02:02.777Z",
184+
"messageType": "ConfigurationItemChangeNotification",
185+
"recordVersion": "1.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3MywtMzAsLTI3LC0yLDk2LC04NCw4MiwzNSw3LDM3LC02NSwxOSwxOCwtOTgsLTEyNCwtMTE2LC0zLDEzLC0xMjgsNjIsMTEyLC0yMSw5OSw3OCw3MywtMjMsMjQsOTcsMzIsNjQsLTkwLC00NSwtNjAsLTU3LC01MiwtNDIsODgsMTIwLDgwLDQ5LDc1LC00LC01NSwtNTEsLTExNywyMywtMjcsMTI3LC0xMTUsLTQxLDEwMiwtNzgsLTEwNCw3OCwxMTksMTEyLDEwMywtMTE3LDY3LC02NCw0MywwLDQ1LC04MCwtMTksLTQ0LC05MywtNyw1NywtMTI2LDYwLDg4LC00NCwtNzEsODAsLTYsMzgsLTc4LC0xNSwzNiwtMTYsMjYsMCwtNzcsNjgsLTYsNDQsNywxMywxMjQsNTMsMjksLTQzLC0xMjEsMjcsOTcsMTIzLDExMSwzMCwxMCw0NSwtNTYsLTc2LDcsNDUsLTEyLDI3LC00NCwtMTA3LDc3LDQ1LC0xMDEsMzMsNzYsLTQ1LDExMiwtMTI1LDQ5LDc4LDgyLC04LDMxLC0xMjcsMTE3LDQzLDc3LDEyMSw5M10sIm1hdGVyaWFsU2V0U2VyaWFsTnVtYmVyIjoxLCJpdlBhcmFtZXRlclNwZWMiOnsiaXYiOlszMCw5NiwtNSw5NywtMjcsLTEwMywxMTYsLTgwLC0xMywtMTA4LC01MywtNDksMiw1MiwtNTAsMjldfX0=",
188+
"eventLeftScope": "False",
189+
"ruleParameters": "{}",
190+
"executionRoleArn": "arn:aws:iam::123456789000:role/config-role",
191+
"accountId": "123456789000"
192+
}

lambda_sample_events/sample_event.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717
'kinesis_stream',
1818
's3_put',
1919
's3_delete',
20-
'cloudwatch_logs'
20+
'cloudwatch_logs',
21+
'cloudwatch_events',
22+
'config_rule'
2123
]
2224

2325
class SampleEvent(object):

tests/sample_event_test.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
'kinesis_stream',
1919
's3_put',
2020
's3_delete',
21-
'cloudwatch_logs'
21+
'cloudwatch_logs',
22+
'cloudwatch_events',
23+
'config_rule'
2224
]
2325

2426
def test_invalid_service_name():

0 commit comments

Comments
 (0)