Skip to main content

CloudWatch Dashboard Basic

πŸ“¦ Overview​

This Terraform module provisions a basic Amazon CloudWatch Dashboard using a custom JSON layout defined by the user.

It’s ideal for consolidating monitoring metrics across services and presenting operational insights in a single, shareable dashboard.


βœ… Key Features​

  • Creates a CloudWatch dashboard with a customizable layout
  • Accepts full dashboard body as JSON string input
  • Centralizes performance, usage, or cost metrics
  • Integrates with alarms and logging for observability

πŸ’Ό Use Cases​

  • Visualizing EC2 or Lambda metrics in real time
  • Creating app-specific or environment-specific dashboards
  • Sharing system health views with development and ops teams
  • Consolidating multi-service monitoring into a single pane

πŸ“₯ Input Variables​

NameTypeDescription
regionstringAWS region where the dashboard is created
dashboard_namestringThe name to assign to the CloudWatch Dashboard
dashboard_bodystringJSON-formatted body that defines widgets and layout
environmentstringTag to specify the deployment environment (e.g., dev, staging, prod)

πŸ“€ Outputs​

NameDescription
dashboard_nameThe name of the deployed CloudWatch Dashboard
dashboard_arnThe ARN of the dashboard resource

πŸš€ Deployment Readiness​

  • βœ… Compatible with Terraform 1.0+
  • βœ… Tested with AWS provider 5.x
  • πŸ§ͺ Requires a valid JSON layout string for dashboard body

πŸ› οΈ Example Usage​

module "cloudwatch-dashboard-basic-deployment" {
source = "git::ssh://git@github.com/archiphire/aws-level-1-modules.git//monitoring/cloudwatch-dashboard-basic?ref=v1.0.0"

region = "us-east-1"
dashboard_name = "system-health-dashboard"
dashboard_body = <<EOT
{
"widgets": [
{
"type": "metric",
"x": 0,
"y": 0,
"width": 12,
"height": 6,
"properties": {
"metrics": [["AWS/EC2", "CPUUtilization", "InstanceId", "i-0123456789abcdef0"]],
"period": 300,
"stat": "Average",
"region": "us-east-1",
"title": "EC2 CPU Utilization"
}
}
]
}
EOT
environment = "prod"
}
terraform init
terraform plan
terraform apply

or

tofu init
tofu plan
tofu apply

🧹 Cleanup Options​

terraform destroy

or

tofu destroy

Manual Deletion (for production):

aws cloudwatch delete-dashboards --dashboard-names system-health-dashboard

πŸ›‘οΈ Notes​

This is a Level 1 monitoring module. To extend functionality, pair this dashboard with:

cloudwatch-alarm-cpu cloudwatch-log-group eventbridge-rule

πŸ”’ Deployment Package Notice​

This module is part of the Level 1 AWS License Tier. To access the full deployment package and source code, subscribe to Archiphire.