Description
EC2 detailed monitoring provides most instance metrics at one-minute intervals instead of the basic five-minute intervals. Basic monitoring remains available, and status-check metrics use one-minute intervals regardless of detailed monitoring.
Potential impact
Five-minute metrics can make brief CPU spikes or network load harder to investigate in detail.
Remediation
Set monitoring = true to enable detailed monitoring. Consider the required response time and additional cost, and configure the metric alarms you need.
Examples
The examples enable detailed monitoring on the same EC2 instance.
Before
hcl
resource "aws_instance" "example" {
ami = data.aws_ami.ubuntu.id
instance_type = "t3.micro"
tags = {
Name = "HelloWorld"
}
}
After
hcl
resource "aws_instance" "example" {
ami = data.aws_ami.ubuntu.id
monitoring = true
instance_type = "t3.micro"
tags = {
Name = "HelloWorld"
}
}