In AWS CloudWatch I can create an alarm that will alert me if my database has too many connections:
And I have used terraform to create another alarm ...
resource "aws_cloudwatch_metric_alarm" "cpu_utilization_too_high" {
alarm_name = "cpu_utilization_too_high"
comparison_operator = "GreaterThanThreshold"
evaluation_periods = "1"
metric_name = "CPUUtilization"
namespace = "AWS/RDS"
period = "600"
statistic = "Average"
threshold = var.cpu_utilization_threshold
alarm_description = "Average database CPU utilization over last 10 minutes too high"
alarm_actions = [aws_sns_topic.topic.arn]
ok_actions = [aws_sns_topic.topic.arn]
dimensions = {
DBInstanceIdentifier = "${var.db_instance_id}"
}
}
Now I want to use terraform to create an alarm that will alert me to my database connections but I do not know what to set metric_name
to ...
metric_name = ???TooMuchConnectingtoDataBase???
I have looked at the terraform documentation but it doesn't document what do use for the metric_name. https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm