Automated Cloud Expenditure Governance and Idle Instance Remediation on AWS EC2 Using Python Boto3 and CloudWatch Telemetry
Companies running applications in the public cloud often end up paying for far more computing power than they actually use. Because engineers can launch virtual servers in a couple of minutes, temporary test machines and oversized instances frequently stay powered on long after their work is done. Standard billing alerts do little to prevent this waste because they only notify managers after the monthly spending cap has already been crossed. To fix this gap, we built an automated cloud cost governance tool for Amazon Web Services (AWS) Elastic Compute Cloud (EC2) using Python and the Boto3 Software Development Kit (SDK). Running from a central Linux node without requiring background agents on target machines, the script pulls live CPU utilization, network traffic, and disk activity straight from AWS CloudWatch. It calculates rolling hourly utilization averages against a strict 5.0% CPU cutoff to separate genuinely abandoned "zombie" servers from intermittent batch jobs. When an instance stays below the 5.0% mark for a full hour, the system stops it automatically and sends an alert through Amazon Simple Notification Service (SNS). In tests across ten EC2 instances spanning web servers, cyclical batch processors, and idle nodes, the tool shut down every idle server while leaving active and bursty workloads untouched—saving an estimated $210.24 per month for every three idle m5. large instances.
Authors
- Mr. Lokesh K., Abdul Rahman., Darshan S., Dipak Singh., Hithashri T.
Publication Details
- Journal
- Zenodo (CERN European Organization for Nuclear Research)
- Published
- 2026-11-04
- DOI
- https://doi.org/10.5281/zenodo.23944021
- Primary Topic
- Cloud Computing and Resource Management
- Type
- article
- Field-Weighted Citation Impact
- 0.00