arabold / aws-to-slack

Forward AWS CloudWatch Alarms and other notifications from Amazon SNS to Slack.
MIT License
294 stars 111 forks source link

Cloudwatch Events Integrations [Feature Request] #72

Open sreedharbukya opened 5 years ago

sreedharbukya commented 5 years ago

Hey Team,

Can you guide me to build the cloud watch events something like SPOT Instance termination events to come in Slack channel?.

Currently, It just works as generic events, but I would like to get bare minimum tags like Instance Name or Instance type and AZ name.

Current notification to Slack.

aws.ec2 (ap-southeast-1 - XXXXXX)
EC2 Instance State-change Notification
version
0
id
e88ed778-8861-7f63-b63c-089cbb569a17
resources
["arn:aws:ec2:ap-southeast-1:XXXX:instance/i-047dd4e31a66a990b"]
detail
{"instance-id":"i-047dd4e31a66a990b","state":"terminated"}```

Desired Notification

aws.ec2 (ap-southeast-1 - XXXXXX) EC2 Instance State-change Notification SPOT Instance State change : Name: foo-bar in region az and reason for it ?? Instance ID: i-047dd4e31a66a990b State Change STATE → TERMINATED Region Asia Pacific (Singapore)

homeyjd commented 5 years ago

To create a parser, we need an example raw JSON event as received from CloudWatch.

In your requested format, it looks like a parser would need to:

It might be a little easier to simplify this format a little.
Open to a PR if you'd like!