Editing Terraform resource: aws cloudwatch metric alarm
Jump to navigation
Jump to search
Warning: You are not logged in. Your IP address will be publicly visible if you make any edits. If you log in or create an account, your edits will be attributed to your username, along with other benefits.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
* https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm | * https://registry.terraform.io/providers/hashicorp/aws/latest/docs/resources/cloudwatch_metric_alarm | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Examples == | == Examples == | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
resource "aws_cloudwatch_metric_alarm" "db_cpu_utilization_too_high" { | resource "aws_cloudwatch_metric_alarm" "db_cpu_utilization_too_high" { | ||
[[alarm_name]] = format("%s-%s", lower("${var.rds_name}"), "db-highCPUUtilization") | [[alarm_name]] = format("%s-%s", lower("${var.rds_name}"), "db-highCPUUtilization") | ||
Line 59: | Line 20: | ||
} | } | ||
− | + | <pre> | |
− | + | resource "aws_cloudwatch_metric_alarm" "db_disk_queue_depth_too_high" { | |
− | |||
alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-highDiskQueueDepth") | alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-highDiskQueueDepth") | ||
comparison_operator = "GreaterThanThreshold" | comparison_operator = "GreaterThanThreshold" | ||
Line 71: | Line 31: | ||
threshold = "10" | threshold = "10" | ||
alarm_description = "Average database disk queue depth is too high, performance may be negatively impacted." | alarm_description = "Average database disk queue depth is too high, performance may be negatively impacted." | ||
− | + | ||
dimensions = { | dimensions = { | ||
DBInstanceIdentifier = aws_db_instance.rds_instance.id | DBInstanceIdentifier = aws_db_instance.rds_instance.id | ||
} | } | ||
− | + | } | |
− | + | resource "aws_cloudwatch_metric_alarm" "db_disk_free_storage_space_too_low" { | |
− | |||
− | |||
alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeStorageSpace") | alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeStorageSpace") | ||
comparison_operator = "[[LessThanThreshold]]" | comparison_operator = "[[LessThanThreshold]]" | ||
Line 93: | Line 51: | ||
DBInstanceIdentifier = aws_db_instance.rds_instance.id | DBInstanceIdentifier = aws_db_instance.rds_instance.id | ||
} | } | ||
− | + | } | |
− | + | resource "aws_cloudwatch_metric_alarm" "db_memory_freeable_too_low" { | |
− | |||
alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeableMemory") | alarm_name = format("%s-%s", lower("${var.rds_name}"), "db-lowFreeableMemory") | ||
comparison_operator = "LessThanThreshold" | comparison_operator = "LessThanThreshold" | ||
Line 110: | Line 67: | ||
DBInstanceIdentifier = aws_db_instance.rds_instance.id | DBInstanceIdentifier = aws_db_instance.rds_instance.id | ||
} | } | ||
− | + | } | |
+ | </pre> | ||
− | == ChatGPT examples | + | == ChatGPT examples (01/2023) == |
resource "aws_cloudwatch_metric_alarm" "elb_5xx_error_rate" { | resource "aws_cloudwatch_metric_alarm" "elb_5xx_error_rate" { | ||
alarm_name = "elb_5xx_error_rate" | alarm_name = "elb_5xx_error_rate" | ||
Line 118: | Line 76: | ||
evaluation_periods = "5" | evaluation_periods = "5" | ||
[[metric_name]] = "[[HTTPCode_Backend_5XX]]" | [[metric_name]] = "[[HTTPCode_Backend_5XX]]" | ||
− | [[namespace]] = " | + | [[namespace]] = "AWS/ApplicationELB" |
period = "60" | period = "60" | ||
statistic = "SampleCount" | statistic = "SampleCount" | ||
Line 184: | Line 142: | ||
* <code>[[aws cloudwatch metric alarm]]</code> | * <code>[[aws cloudwatch metric alarm]]</code> | ||
* <code>[[alarm_actions]]</code> | * <code>[[alarm_actions]]</code> | ||
− | * | + | * [[aws_sns_topic]] |
== See also == | == See also == |
Advertising: