This is a template to use for baseline. The default actions will provide updates for section between Requirements and Outputs.
This Terraform module provides a standardized way to set up and monitor various AWS resources using CloudWatch metrics. It simplifies the integration of CloudWatch monitoring for EC2 instances and Load Balancers by encapsulating commonly used configurations into reusable modules.
The module is structured to include CloudWatch metric alarms for CPU utilization, disk usage, memory usage, and instance status for EC2 instances. It also includes monitoring for ALB request counts, target response times, and unhealthy host counts.
This module creates and manages the following types of resources:
- CloudWatch alarms for:
- EC2 CPU utilization
- EC2 disk usage
- EC2 memory usage
- EC2 instance status checks
- ALB request count
- ALB target response time
- ALB unhealthy hosts
- CloudWatch Agent setup for EC2 instances
module "cloudwatch-monitoring" {
source = "git::https://github.com/tothenew/terraform-aws-cloudwatch-alarm"
instance_id = ["i-000000000"]
alb_names = ["test-1"]
target_group_name = ["test-tg"]
requests = true
loadbalancers = {
alb1 = {
name = "test-1"
target_group = "test-tg"
az = "us-east-1a"
}
}
}| Name | Version |
|---|---|
| terraform | >= 1.3.0 |
No providers.
| Name | Source | Version |
|---|---|---|
| agent | ./module/ec2-cw-agent/ | n/a |
| ec2-CloudWatch-cpu | ./module/ec2-cw/cpu | n/a |
| ec2-CloudWatch-disk | ./module/ec2-cw/disk | n/a |
| ec2-CloudWatch-memory | ./module/ec2-cw/memory | n/a |
| ec2-CloudWatch-status | ./module/ec2-cw/status | n/a |
| lb_request | ./module/load-balancer/requestCount/ | n/a |
| lb_target_response_time | ./module/load-balancer/targetresponsetime/ | n/a |
| unhealthyhost | ./module/load-balancer/unhealthyHost/ | n/a |
No resources.
| Name | Description | Type | Default | Required |
|---|---|---|---|---|
| alb_names | n/a | list(string) |
[ |
no |
| instance_id | n/a | list(string) |
[ |
no |
| loadbalancers | n/a | map(object({ |
n/a | yes |
| requests | n/a | bool |
true |
no |
| target_group_name | n/a | list(string) |
[ |
no |
No outputs.
Module managed by TO THE NEW Pvt. Ltd.
Apache 2 Licensed. See LICENSE for full details.