Skip to content

AWS Lambda function to remove CloudWatch Alarms for an EC2 Instance when that instance is terminated

License

Notifications You must be signed in to change notification settings

Dwolla/cloudwatch-alarm-cleanup

Repository files navigation

CloudWatch Alarm Cleanup

Dwolla/cloudwatch-alert-cleanup CI license

A Serverless application for AWS Lambda that will accept autoscaling:EC2_INSTANCE_TERMINATING lifecycle events, identify the EC2 instance ID of the terminating instance, and remove any CloudWatch alarms with an InstanceId dimension matching the terminating instance ID.

The application is written in Scala.JS to be deployed to the Lambda Node runtime.

Deploy

Run sbt deploy to build and deploy the application. The ARN of the Lambda function will be exported by CloudFormation as cloudwatch-alarm-cleanup:production:RemoveCloudWatchAlarmsArn. The export can be imported by other CloudFormation stacks to attach the Lambda function as a target for lifecycle events.

Credits

AWS Lambda and CloudWatch Scala.js facades were generated from TypeScript definitions derived from the AWS documentation and TypeScript definitions included with the AWS JavaScript SDK using the Scala.js TypeScript importer tool, and then manually modified to meet the needs of this project.

About

AWS Lambda function to remove CloudWatch Alarms for an EC2 Instance when that instance is terminated

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published