257 words
1 minute
Cloud EC2 Monitor

A Python CLI tool that retrieves AWS EC2 instance information and generates simple usage reports for monitoring cloud environments.

Overview#

This project demonstrates basic cloud infrastructure monitoring using the AWS SDK for Python (boto3). The tool queries EC2 instances and reports information such as instance IDs, current status, and launch time.

The goal of the project is to explore how infrastructure engineers and developers interact with cloud APIs to inspect and monitor computing resources.

Features#

  • Retrieve EC2 instance metadata
  • Display instance IDs and instance state
  • Show instance launch time
  • Generate simple usage reports
  • Command-line interface for quick infrastructure inspection

Technologies Used#

  • Python
  • AWS EC2
  • boto3 (AWS SDK for Python)
  • AWS CLI
  • Git

Project Structure#

cloud-ec2-monitor/
├── monitor.py
├── usage_report.txt
├── requirements.txt
├── README.md
└── .gitignore

Setup#

1. Clone the repository#

Terminal window
git clone https://github.com/BerkGozek/cloud-monitor.git
cd cloud-monitor

2. Create a virtual environment#

Terminal window
python3 -m venv .venv
source .venv/bin/activate

3. Install dependencies#

Terminal window
pip install -r requirements.txt

4. Configure AWS credentials#

Before running the tool, configure AWS CLI credentials:

Terminal window
aws configure

You will be prompted to enter:

AWS Access Key ID
AWS Secret Access Key
Default region name (example: us-east-1)
Default output format (json recommended)

Running the Tool#

Run the monitoring script:

Terminal window
python monitor.py

To generate a usage report file:

Terminal window
python monitor.py > usage_report.txt

Example Output#

Instance ID: i-0123456789abcdef0
Status: running
Launch Time: 2026-03-10T14:22:31Z

Use Case#

This tool simulates a lightweight infrastructure monitoring workflow used by cloud engineers and DevOps teams to inspect compute resources in a cloud environment.

It demonstrates how developers can use Python to interact with cloud APIs and retrieve operational data from infrastructure services.

Future Improvements#

Potential improvements for this project include:

  • Support for additional AWS services (S3, Lambda, RDS)
  • Automatic report generation and logging
  • Monitoring alerts for instance state changes
  • Command-line arguments for filtering or selecting regions
  • Integration with monitoring dashboards
berkgozek
/
cloud-ec2-monitor
Waiting for api.github.com...
00K
0K
0K
Waiting...