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.
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.
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.