This project is a fully automated cloud monitoring solution built with Terraform and Docker. It provisions an AWS EC2 instance and deploys a complete monitoring stack (Prometheus, Grafana, and Node Exporter) to track system health in real-time.
This is the infrastructure and monitoring configuration. For the dashboard visualization, a screenshot is provided below.
You don't need to manually install Prometheus or Grafana. The entire stack runs inside Docker containers on a cloud instance managed by Terraform.
- Download the appropriate package for your OS from the official Terraform website.
- Extract the executable and add it to your system's PATH.
- Verify installation:
terraform -version
- Install the AWS CLI by following the official AWS guide.
- How to get AWS Credentials:
- Log in to your AWS Management Console.
- Search for IAM in the search bar and click on it.
- In the left sidebar, click on Users and select your user (or create a new one with
AdministratorAccess). - Go to the Security credentials tab.
- Scroll down to the Access keys section and click Create access key.
- Select Command Line Interface (CLI).
- IMPORTANT I advise you to download the
.csvfile, as this is the only time you will see the secret key. - Run the configuration command (in terminal):
aws configure
- For default output format, type 'json'.
- Go to the AWS Console -> EC2 -> Network & Security -> Key Pairs.
- Create a new key pair named
prometheus-key. - Download the
.pemfile and keep it in a secure location.
git clone https://github.com/iustinflorian/prometheus_metrics.git
cd prometheus_metrics
prometheus_metrics/
├── prometheus/
│ └── prometheus.yml # Prometheus configuration and scrape targets
├── .gitignore # Excludes sensitive files (tfstate, keys, etc.)
├── docker-compose.yml # Orchestrates the monitoring stack containers
├── grafana-preview.jpg # Dashboard screenshot for visual documentation
└── main.tf # Terraform code for AWS infrastructure
- Initialize Terraform and create the AWS resources:
terraform init
terraform apply -auto-approve
- Connect to the EC2 instance and launch the monitoring stack with a single command:
sudo docker-compose up -d
- Grafana: http://your-ec2-ip:3000 (Login: admin / admin)
- Prometheus: http://your-ec2-ip:9090
- Cloud: AWS (EC2, Security Groups)
- Infrastructure as Code (IaC): Terraform
- Containerization: Docker & Docker Compose
- Monitoring: Prometheus & Node Exporter
- Visualization: Grafana
This project is licensed under the MIT License - see the LICENSE file for details.
