Reputation: 349
I have a requirement where I want to send notifications to a REST
service from AWS
every time a VM is started/stopped. Is it possible to achieve this using CloudWatch
or any other AWS
service?
Upvotes: 1
Views: 69
Reputation: 52393
Yes. You can do it by using AWS Lambda in combination with AWS Cloudtrail.
Enable Cloudtrail and make it write to a S3 bucket. When a new object is written to that bucket by Cloudtrail, S3 can be made to trigger a lambda function.
In the lambda function, you parse the cloudtrail log and if you find a startinstance or stopinstance, you send a notification.
It may sound difficult, but it is pretty straightforward. I did this for a different reason. Check my answer here: Mandatory tagging when launching EC2 instance
Upvotes: 1