1 year ago
#372729
Hemant kumar
How to implement AWS RDS Read/Write Latency Cloudwatch alarms using Terraform
I want to set new AWS RDS Read/Write Latency Cloudwatch alarms using Terraform. I have googled a alot to find some examples for the same but i didn't find any.
what i have wrote in the terraform main.tf. Is this code snippet correct or not?
resource "aws_cloudwatch_metric_alarm" "postgres_write_latency" {
count = length(var.db_instance_identifier)
alarm_name = "rds-postgres-write-latency-canada"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "WriteLatency"
namespace = "AWS/RDS"
period = "60"
statistic = "Average"
threshold = "2"
treat_missing_data = "breaching"
dimensions = {
DBInstanceIdentifier = element(var.db_instance_identifier, count.index)
}
alarm_description = "Write IOPS for rds postgres in Canada ${terraform.workspace}"
alarm_actions = [var.sns_topic]
ok_actions = [var.sns_topic]
}
resource "aws_cloudwatch_metric_alarm" "postgres_read_latency" {
count = length(var.db_instance_identifier)
alarm_name = "rds-postgres-read-latency-canada"
comparison_operator = "GreaterThanOrEqualToThreshold"
evaluation_periods = "1"
metric_name = "ReadLatency"
namespace = "AWS/RDS"
period = "60"
statistic = "Average"
threshold = "0.030"
treat_missing_data = "breaching"
dimensions = {
DBInstanceIdentifier = element(var.db_instance_identifier, count.index)
}
alarm_description = "Read IOPS for rds postgres in Canada ${terraform.workspace}"
alarm_actions = [var.sns_topic]
ok_actions = [var.sns_topic]
}
I have implemented this code but it start spamming the slack channel due to INSUFFICIENT_DATA.
I need a working terraform code for AWS RDS Read/Write Latency Cloudwatch alarms.
amazon-web-services
terraform
amazon-rds
amazon-cloudwatch
0 Answers
Your Answer