From: Justin Wind Date: Wed, 15 Nov 2017 19:22:49 +0000 (-0800) Subject: add a basic cw alarm X-Git-Url: https://git.squeep.com/?a=commitdiff_plain;ds=sidebyside;p=awsible add a basic cw alarm --- diff --git a/infrastructure/modules/management-stack/alarms.tf b/infrastructure/modules/management-stack/alarms.tf index c278d19..3e244fb 100644 --- a/infrastructure/modules/management-stack/alarms.tf +++ b/infrastructure/modules/management-stack/alarms.tf @@ -29,3 +29,16 @@ resource "aws_cloudwatch_metric_alarm" "failures-present" { } alarm_actions = ["${aws_sns_topic.management-alerts.arn}"] } + +resource "aws_cloudwatch_metric_alarm" "unhealthy" { + alarm_name = "UnhealthyHostCount" + alarm_description = "Alert when any ELB has unhealthy hosts." + metric_name = "UnHealthyHostCount" + comparison_operator = "GreaterThanOrEqualToThreshold" + evaluation_periods = 15 + period = 60 + namespace = "AWS/ELB" + statistic = "Maximum" + threshold = 1 + alarm_actions = ["${aws_sns_topic.management-alerts.arn}"] +} \ No newline at end of file diff --git a/infrastructure/modules/management-stack/iam.tf b/infrastructure/modules/management-stack/iam.tf index 3f85134..78783a1 100644 --- a/infrastructure/modules/management-stack/iam.tf +++ b/infrastructure/modules/management-stack/iam.tf @@ -23,10 +23,15 @@ data "aws_iam_policy_document" "management" { sid = "AWSControl" actions = [ "autoscaling:*", + "cloudwatch:ListMetrics", + "cloudwatch:GetMetricStatistics", + "cloudwatch:Describe*", "ec2:*", "elasticloadbalancing:*", "iam:PassRole", - "iam:GetServerCertificate" + "iam:GetServerCertificate", + "logs:DescribeLogStreams", + "logs:PutLogEvents", ] resources = [ "*"