Monitor AWS EC2 Instance Using CloudWatch and Grafana
- Siddhesh Kadam

- 2 days ago
- 2 min read
Monitoring EC2 instances is a basic but critical task for every DevOps engineer. AWS provides CloudWatch for collecting metrics, and Grafana makes visualisation simple and powerful.
In this blog, we will learn how to monitor an AWS EC2 instance using CloudWatch and Grafana, step by step, in a clean and practical way.
🧩 Architecture Overview

✅ Prerequisites
Before starting, make sure you have:
An AWS account
A running EC2 instance
IAM user with programmatic access
Grafana installed (self-hosted or Grafana Cloud)
AWS access key & secret key
Step 1: Enable CloudWatch Monitoring for EC2
By default, AWS sends basic monitoring metrics every 5 minutes.
To enable detailed monitoring (recommended):
Go to EC2 → Instances
Select your instance
Click Actions → Manange detailed monitoring
Enable Detailed monitoring


This enables:
CPU Utilization
Network In / Out
Disk Read / Write
Status Check metrics (1-minute interval)
Step 2: Create / Update IAM User Permissions
Grafana needs permission to read CloudWatch Metrics and Logs.
Attach the following policy to your IAM user:
✅ IAM Policy for Grafana (Recommended)
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"cloudwatch:GetMetricData",
"cloudwatch:GetMetricStatistics",
"cloudwatch:ListMetrics",
"logs:DescribeLogGroups",
"logs:DescribeLogStreams",
"logs:GetLogEvents",
"logs:FilterLogEvents",
"ec2:DescribeInstances",
"ec2:DescribeRegions",
"tag:GetResources"
],
"Resource": "*"
}
]
}


📌 This policy allows:
Reading EC2 metrics
Reading CloudWatch logs
Discovering EC2 instances
Viewing tags (useful for filtering)
Step 3: Add CloudWatch as Data Source in Grafana
Login to Grafana
Go to Configuration → Data Sources
Click Add data source
Select CloudWatch
Configure as below:
Field | Value |
Authentication Provider | Access & Secret Key |
Access Key | Your AWS access key |
Secret Key | Your AWS secret key |
Default Region | ap-south-1 (or your region) |
Assume Role ARN | Leave empty |
Click Save & Test

✅ You should see:
Successfully queried the CloudWatch matrics API.
Step 4: Import EC2 Dashboard
Grafana provides ready-made dashboards for AWS EC2.
Import Dashboard
Go to Dashboards → Import
Enter Dashboard ID:
1860Select:
Data source → CloudWatch
Region → Your AWS region
Instance → Your EC2 instance

Click Import

🎉 Result
You will now see a live dashboard showing:
CPU Utilization
Network In / Out
Disk Read / Write
Instance status checks
EC2 health metrics


All updated in real time from CloudWatch.
Conclusion
By integrating AWS CloudWatch with Grafana, you can easily monitor EC2 performance metrics in real time using powerful and interactive dashboards. This setup helps you gain better visibility into system health, detect issues early, and improve overall infrastructure reliability with minimal effort.



















Comments