This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const p = require('phin'); | |
// input your slack webhook | |
const reqURL = `https://hooks.slack.com/services/xxxxxxxxxxxxxxxxxxxxxxxxxxx`; | |
async function notifySlack(instanceInfo) { | |
const message = { | |
'channel': 'aws-alarm', | |
'username': 'AWS_State_Reporting_Bot', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// EC2 event data json | |
{ | |
"version": "0", | |
"id": "9f8ef89a-bffc-7f81-dab1-596bd6c2d684", | |
"detail-type": "EC2 Instance State-change Notification", | |
"source": "aws.ec2", | |
"account": "465732654097", | |
"time": "2022-03-29T09:19:21Z", | |
"region": "ap-southeast-2", | |
"resources": [ |