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 | ||
aws_cloudwatch_metric_alarm | aws_cloudwatch_metric_alarm | ||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
== Examples == | == Examples == | ||
Line 30: | Line 10: | ||
evaluation_periods = "2" | evaluation_periods = "2" | ||
[[metric_name]] = "[[CPUUtilization]]" | [[metric_name]] = "[[CPUUtilization]]" | ||
− | + | namespace = "[[AWS/RDS]]" | |
period = "30" | period = "30" | ||
− | [[statistic]] = " | + | [[statistic]] = "Average" |
− | threshold = " | + | threshold = "80" |
− | alarm_description = " | + | alarm_description = "Average database CPU utilization is too high." |
dimensions = { | dimensions = { | ||
− | + | DBInstanceIdentifier = aws_db_instance.rds_instance.id | |
} | } | ||
} | } | ||
− | |||
[[CPU]] | [[CPU]] | ||
resource "aws_cloudwatch_metric_alarm" "db_cpu_utilization_too_high" { | resource "aws_cloudwatch_metric_alarm" "db_cpu_utilization_too_high" { | ||
Line 59: | Line 38: | ||
} | } | ||
− | + | <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 49: | ||
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 69: | ||
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 85: | ||
DBInstanceIdentifier = aws_db_instance.rds_instance.id | DBInstanceIdentifier = aws_db_instance.rds_instance.id | ||
} | } | ||
− | + | } | |
+ | </pre> | ||
== ChatGPT examples for [[ALB]] (01/2023) == | == ChatGPT examples for [[ALB]] (01/2023) == | ||
Line 118: | Line 94: | ||
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" |
Advertising: