For this project, I used a TodoList web application that I previously deployed on a AWS EC2 Ubuntu server. The application runs inside a Docker container, which makes it easier to deploy and manage. I wanted to learn how monitoring works in a cloud environment and how engineers can check whether their services are functioning properly. To do this, I added Prometheus to my existing AWS server. Prometheus collects metrics that can help administrators understand the health of their systems and identify problems. For my initial setup, I configured Prometheus to monitor itself while running alongside my TodoList application. This allowed me to practice using Docker, cloud networking, and monitoring tools together.
I chose Prometheus because it is free, open source, and works well with Docker and AWS. It collects metrics that help monitor whether services are running correctly. Prometheus is useful because it stores metrics over time and allows users to run queries. One limitation is that it requires additional configurations to monitor individual applications. I chose it over AWS CloudWatch because I wanted hands-on experience setting up a monitoring tool myself. I used my existing AWS EC2 Ubuntu server with Docker installed. I created a Prometheus.yml configuration file to collect Prometheus metrics every 15 seconds. global:
scrape_interval: 15s
scrape_configs:
- job_name: "prometheus"
static_configs:
- targets: ["localhost:9090"]
I then started Prometheus using Docker.
docker run -d \
--name prometheus \
-p 9090:9090 \
-v "$(pwd)/prometheus.yml:/etc/prometheus/prometheus.yml" \
prom/prometheus
finally, I configured my AWS security group to allow TCP port 9090 from my IP address. I used docker ps to verify that my container were running.
My TodoList application and Prometheus run in separate Docker container on the same AWS EC2 server. I configured Prometheus to collect its own metrics every 15 seconds and store them for monitoring. I used the Prometheus web interface to view metrics and run queries. For this project, I focused on basic monitoring rather than setting up additional dashboards or alerts in the future, I could configure Prometheus to collect metrics directly form my TodoList application. After installing Prometheus, I opened its web interface using my AWS server's public IP address and port 9090. The Prometheus Targets page showed a status of UP, meaning it was successfully collecting metrics. I also ran the PromQL query up, which returned a value of 1. This confirmed that Prometheus was successfully monitoring its configured target.

Security was important because my application and Prometheus were running on an AWS cloud server. I configured the AWSS security group to restrict access to Prometheus on port 9090 to my IP address. Prometheus did not have additional authentication configured, so limiting network access helped reduce security risks. In a production environment, I would also use HTTPS, authentication, and appropriate data retention settings to better protect the monitoring system.

This diagram shows my TodoList application and Prometheus running in separate Docker containers on an AWS EC2 Ubuntu server. Prometheus collects its own metrics every 15 seconds, and I can view the results through its web interface on port 9090.
This project helped me gain experience with AWS, Docker, and Prometheus. I learned how to configure monitoring, check service availability, and use PromQL queries. In the future, I would like to monitor my TodoList application directly and add alerts.
References
Prometheus Documentation
Docker Documentation
AWS EC2 Documentation


Top comments (1)
Could you provide a clearer, step-by-step explanation of how to do this? Also, could you share what your appβs original code looks like so I can better understand your current implementation and help you troubleshoot the issue?