Skip to content

Commit

Permalink
Merge pull request #76 from Crown-Commercial-Service/ZD-74998
Browse files Browse the repository at this point in the history
Extend CloudWatch Dashboard to allow EC2 metrics
  • Loading branch information
ghill95 authored Nov 18, 2024
2 parents e76f2f5 + 4760aa6 commit 03bfcd4
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 0 deletions.
54 changes: 54 additions & 0 deletions resource-groups/cloudwatch-dashboard/cloudwatch_dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,60 @@ resource "aws_cloudwatch_dashboard" "cloudwatch_dashboard" {
"view": "timeSeries"
}
},
{
type: "metric",
properties: {
"metrics": [
for ec2_instance_id in var.ec2_instance_ids : [
"AWS/EC2",
"CPUUtilization",
"InstanceId",
ec2_instance_id,
]
],
"period": 60
"region": var.region,
"stacked": false,
"title": "ec2_instances_cpu_utilization",
"view": "timeSeries"
}
},
{
type: "metric",
properties: {
"metrics": [
for ec2_instance_id in var.ec2_instance_ids : [
"AWS/EC2",
"NetworkIn",
"InstanceId",
ec2_instance_id,
]
],
"period": 60
"region": var.region,
"stacked": false,
"title": "ec2_instances_network_in",
"view": "timeSeries"
}
},
{
type: "metric",
properties: {
"metrics": [
for ec2_instance_id in var.ec2_instance_ids : [
"AWS/EC2",
"NetworkOut",
"InstanceId",
ec2_instance_id,
]
],
"period": 60
"region": var.region,
"stacked": false,
"title": "ec2_instances_network_out",
"view": "timeSeries"
}
},
]
}
)
Expand Down
5 changes: 5 additions & 0 deletions resource-groups/cloudwatch-dashboard/variables.tf
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ variable "region" {
type = string
}

variable "ec2_instance_ids" {
description = "The ID(s) of the EC2 instances you wish to monitor (must be in list format)"
type = list(string)
}

variable "ecs_service_names" {
description = "The name(s) of the ECS Services you wish to monitor (must be in list format)"
type = list(string)
Expand Down

0 comments on commit 03bfcd4

Please sign in to comment.