3
1

More than 3 years have passed since last update.

terraformで死活監視(ALBのhalthyhostsを監視)

Posted at

トピックを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
  }
}
3
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
1