Skip to content

Terraform module for creating AWS ALB Error rate based CloudWatch Alarm.

License

Notifications You must be signed in to change notification settings

topotal/terraform-aws-alb-error-rate-based-alarm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

terraform-aws-alb-error-rate-based-alarm

Terraform module for creating AWS ALB Error rate based CloudWatch Alarm.

https://registry.terraform.io/modules/topotal/alb-error-rate-based-alarm/aws/latest

Usage

Copy and paste into your Terraform configuration, insert the variables, and run terraform init:

module "alb-error-rate-based-alarm" {
  source  = "topotal/alb-error-rate-based-alarm/aws"
  version = "0.2.1"

  sns_topic_arn  = "YOUR_SNS_TOPIC_ARN_FOR_NOTIFICATION"
  dimensions     = {
    LoadBalancer = "app/YOUR_LOAD_BALANCER_NAME/YOUR_LOAD_BALANCER_ID"
  }
}

or you can speficy TargetGroup to dimensions if you want to monitor only for TargetGroup:

module "alb-error-rate-based-alarm" {
  source  = "topotal/alb-error-rate-based-alarm/aws"
  version = "0.2.1"

  sns_topic_arn  = "YOUR_SNS_TOPIC_ARN_FOR_NOTIFICATION"
  dimensions     = {
    LoadBalancer = "app/YOUR_LOAD_BALANCER_NAME/YOUR_LOAD_BALANCER_ID"
    TargetGroup  = "targetgroup/YOUR_TARGET_GROUP_NAME/YOUR_TARGET_GROUP_ID"
  }
}

The default threshold is 99.9% SLO and 14.4 Burn Rate with 1 hour time window (SLO budget consumption 2%).

This module can also specify slo, burn_rate and window like below:

module "alb-error-rate-based-alarm" {
  source  = "topotal/alb-error-rate-based-alarm/aws"
  version = "0.2.1"

  sns_topic_arn  = "YOUR_SNS_TOPIC_ARN_FOR_NOTIFICATION"
  dimensions     = {
    LoadBalancer = "app/YOUR_LOAD_BALANCER_NAME/YOUR_LOAD_BALANCER_ID"
  }

  slo       = 99.99
  burn_rate = 6
  period    = 60 * 60 * 6
}

Requirements

Name Version
terraform >= 1.0.0
aws >= 3.74.0

Providers

Name Version
aws >= 3.74.0

Modules

No modules.

Resources

Name Type
aws_cloudwatch_metric_alarm.alarm resource

Inputs

Name Description Type Default Required
alarm_description The description of the alarm string "This alarm monitors ALB/TargetGroup error rate with burn rate" no
alarm_name The name of the alarm string "alb-error-rate-alarm" no
burn_rate The burn rate to use for the alarm number 14.4 no
comparison_operator The comparison operator to use for the alarm string "GreaterThanOrEqualToThreshold" no
dimensions The dimensions to use for the metrics map(string) n/a yes
evaluation_periods The number of periods over which data is compared to the specified threshold string "1" no
insufficient_data_actions The list of actions to take when the alarm is in insufficient data state list(string) [] no
slo The SLO to use for the alarm number 99.9 no
sns_topic_arn The arn of the SNS topic to use for alarm notifications string n/a yes
window The window to use for the metrics number 3600 no

Outputs

Name Description
cloudwatch_alarm The created CloudWatch alarm

About

Terraform module for creating AWS ALB Error rate based CloudWatch Alarm.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages