トピックをChatbotでサブスクライブすれば、いい感じのグラフと一緒にslack通知されます。
resource "aws_sns_topic" "cloudwatch_topic" {
name = "${var.app_name}-${var.env}-cloudwatch-topic"
}
resource "aws_cloudwatch_metric_alarm" "alb_healthyhosts" {
alarm_name = "${var.app_name}-${var.env}-alb-healthyhosts"
namespace = "AWS/ApplicationELB"
metric_name = "HealthyHostCount"
comparison_operator = "LessThanThreshold"
evaluation_periods = 2
period = 60
statistic = "Average"
threshold = 1
alarm_actions = [aws_sns_topic.cloudwatch_topic.arn]
ok_actions = [aws_sns_topic.cloudwatch_topic.arn]
dimensions = {
TargetGroup = aws_lb_target_group.xxx..arn_suffix
LoadBalancer = aws_alb.xxx.arn_suffix
}
}