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β
| Name | Type | Description |
|---|---|---|
| region | string | AWS region where the dashboard is created |
| dashboard_name | string | The name to assign to the CloudWatch Dashboard |
| dashboard_body | string | JSON-formatted body that defines widgets and layout |
| environment | string | Tag to specify the deployment environment (e.g., dev, staging, prod) |
π€ Outputsβ
| Name | Description |
|---|---|
| dashboard_name | The name of the deployed CloudWatch Dashboard |
| dashboard_arn | The 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.