Reputation: 956
I would like to know if there is a way to trigger an alert if an instance with a particular TAG is terminated . I want to plainly use Cloudtrail/cloudwatch/Lambda to send email .
Upvotes: 0
Views: 920
Reputation: 11708
You can use AWS Cloudwatch Events for that.
Basically you create an Event Rule with Service Type as EC2 and Event Type as "EC2 instance state-change notification" and "terminated" as the selected state that. In the target select your Lambda function.
Now your Lambda will get invoked on all the EC2 instances that get terminated. You will then have to filter in Lambda based on the tag
Upvotes: 3