An Ec2 Alarm that when triggered will create an SSM OpsItem #496
Labels
effort/small
Small work item – less than a day of effort
feature-request
A feature should be added or improved.
language/python
Related to Python examples
p2
🚀 Feature Request
General Information
Description
This example shows how you can use the cdk to automate attaching an alarm to an ec2 instance at launch time, then when the alarm is triggered how it can create an systems manager opsitem with an associated run book.
Proposed Solution
The workflow of this solution is as follows: When an EC2 instance is launched it will trigger an Eventbridge rule that kicks off a lambda function. The lambda function determines if the EC2 instance already has a matching alarm. If it does not then it will create and attach a "StatusCheckFailed" metric alarm and tag the instance so next time it is launched it will skip the Alarm creation logic.
The solution also deploys an SSM automation run command document that can be used to easily trigger the alarm via a bash
shell script that executes the set-alarm-state aws cli command.
Once the alarm is triggered another Eventbridge rule will kick-off the second lambda function that creates an SSM OpsItem with an associated runbook.
Clean-up: cdk destroy then delete any Alarms that were created
Environment
Other information
The cdk stack deploys the following resources:
The text was updated successfully, but these errors were encountered: