AWS ELB Cloudwatch

July 20, 2023 ยท View on GitHub

This Terraform module manages CloudWatch Alarms for an ALB in the region. It does NOT create or manage Load Balancers, only Metric Alarms.

Requires:

  • AWS Provider
  • Terraform 0.12

Alarms Created

Alarms Always Created:

  • Any 5xx errors from the target group
  • Any 5xx errors from the load balancer
  • Unacceptably high average response times
  • Number of unhealthy hosts
  • Number of healthy hosts

Estimated Operating Cost: $ 0.50 / month

  • $ 0.10 / month for Metric Alarms (5x)

Example

module "aws-alb-alarms" {
  source            = "lorenzoaiello/alb-alarms/aws"
  version           = "x.y.z"
}

Pro Support

opsZero provides support for our modules including:

  • Email support
  • Zoom Calls
  • Implementation Guidance

Providers

NameVersion
awsn/a

Inputs

NameDescriptionTypeDefaultRequired
actions_alarmA list of actions to take when alarms are triggered. Will likely be an SNS topic for event distribution.list(string)[]no
actions_okA list of actions to take when alarms are cleared. Will likely be an SNS topic for event distribution.list(string)[]no
evaluation_periodThe evaluation period over which to use when triggering alarms.string"5"no
healthy_hosts_thresholdThe number of healthy hosts.string"0"no
load_balancer_arnELB ARNstringn/ayes
prefixAlarm Name Prefixstring""no
response_time_thresholdThe average number of milliseconds that requests should complete within.string"50"no
statistic_periodThe number of seconds that make each statistic period.string"60"no
target_group_arnTarget Group ARNstringn/ayes
unhealthy_hosts_thresholdThe number of unhealthy hosts.string"0"no

Resources

NameType
aws_cloudwatch_metric_alarm.healthy_hostsresource
aws_cloudwatch_metric_alarm.httpcode_lb_5xx_countresource
aws_cloudwatch_metric_alarm.httpcode_target_5xx_countresource
aws_cloudwatch_metric_alarm.target_response_time_averageresource
aws_cloudwatch_metric_alarm.unhealthy_hostsresource

Outputs

NameDescription
alarm_httpcode_lb_5xx_countThe CloudWatch Metric Alarm resource block for 5xx errors on the load balancer
alarm_httpcode_target_5xx_countsThe CloudWatch Metric Alarm resource block for 5xx errors on the target group
alarm_target_response_time_averageThe CloudWatch Metric Alarm resource block for unacceptably high response time averages