{"id":37085180,"url":"https://github.com/ojimba01/resourcefit","last_synced_at":"2026-01-14T10:28:15.311Z","repository":{"id":258112559,"uuid":"865489336","full_name":"ojimba01/ResourceFit","owner":"ojimba01","description":"ResourceFit is a command-line tool designed to analyze Docker container resource usage and recommend the most cost-effective AWS EC2 instances. It collects real-time container stats, compares them against EC2 instances, and takes EBS pricing into account to provide tailored recommendations.","archived":false,"fork":false,"pushed_at":"2024-10-24T16:01:38.000Z","size":123,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-09-19T14:02:17.142Z","etag":null,"topics":["aws","cli","command-line","command-line-tool","docker","ec2","python","resource-management","resourcemanagement","resources"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/resourcefit/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ojimba01.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-09-30T16:02:54.000Z","updated_at":"2024-12-30T22:30:32.000Z","dependencies_parsed_at":"2024-10-20T08:47:18.982Z","dependency_job_id":null,"html_url":"https://github.com/ojimba01/ResourceFit","commit_stats":null,"previous_names":["ojimba01/resourcefit"],"tags_count":2,"template":false,"template_full_name":null,"purl":"pkg:github/ojimba01/ResourceFit","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojimba01%2FResourceFit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojimba01%2FResourceFit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojimba01%2FResourceFit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojimba01%2FResourceFit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ojimba01","download_url":"https://codeload.github.com/ojimba01/ResourceFit/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ojimba01%2FResourceFit/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28417228,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-14T10:25:19.714Z","status":"ssl_error","status_checked_at":"2026-01-14T10:22:49.371Z","response_time":107,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["aws","cli","command-line","command-line-tool","docker","ec2","python","resource-management","resourcemanagement","resources"],"created_at":"2026-01-14T10:28:14.745Z","updated_at":"2026-01-14T10:28:15.305Z","avatar_url":"https://github.com/ojimba01.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# ResourceFit\n\n**ResourceFit** is a command-line tool designed to analyze Docker container resource usage and recommend the most cost-effective Amazon Web Services (AWS) EC2 instances based on the container's memory, CPU, and disk space requirements. It fetches real-time container stats, normalizes the data, and compares them against available EC2 instance options, taking AWS EBS storage and pricing into account.\n\n## Features\n\n- **Host Machine Stats:** Collects and displays CPU, memory, disk, and network information from the host machine.\n- **Docker Container Stats:** Analyzes running Docker containers, showing stats like CPU usage, memory consumption, and network I/O.\n- **EC2 Recommendations:** Recommends AWS EC2 instances based on the resource needs of the selected Docker container.\n- **AWS Pricing Data:** Fetches EC2 and EBS pricing data to make cost-efficient recommendations.\n- **Memory and Disk Space Buffers:** Includes customizable memory buffers (50-100%) to ensure recommended instances meet peak resource demands.\n\n## Installation\n\nTo install ResourceFit, follow the steps below:\n\n1. Have python (version 3.9 and above) installed on your device, follow the link below to do this:\n\n    ```bash\n    https://www.python.org/downloads/\n    ```\n\n2. Install ResourceFit:\n\n    ```bash\n    pip install resourcefit\n    ```\n\n## Usage\n\nOnce installed, you can use `resourcefit` from the command line:\n\n```bash\nresourcefit\n```\n\nThe tool will:\n\n1. Display a list of running Docker containers.\n2. Allow you to select a container to analyze.\n3. Show real-time stats for the selected container (CPU, memory, I/O).\n4. Fetch and display AWS EC2 and EBS pricing data.\n5. Recommend the top three EC2 instances based on the selected container's resource usage and disk space requirements.\n\n## Example Output\n\n```bash\nSelect a container to analyze:\n1. webapp (ID: 123abc456def) - Image: webapp:latest\n2. nginx (ID: 789ghi012jkl) - Image: nginx:latest\n\nEnter the number of the container (default 1) [1]:\n\nSelected Container ID: 123abc456def\n\nDocker Container Stats:\ncontainer_id: 123abc456def\nname: webapp\ncpu_usage: 0.24%\nmem_usage: 256.00 MiB / 1.00 GiB\nmem_percentage: 25.00%\nnet_io_rx: 10.00 kB\nnet_io_tx: 5.00 kB\nblock_io_read: 0.00 MB\nblock_io_write: 0.05 MB\npids: 5\n\nFetching AWS EC2 pricing data...\n\nTop 3 EC2 Instance Recommendations:\n    Instance Type  Memory  vCPU             Storage  priceMonthly\n191      t4g.nano     0.5     2  EBS only (5.00 GB)         3.466\n277      t3a.nano     0.5     2  EBS only (5.00 GB)         3.831\n648       t3.nano     0.5     2  EBS only (5.00 GB)         4.196\n```\n\n## Dependencies\n\nResourceFit requires the following Python libraries:\n\n- `psutil`: For host machine stats.\n- `docker`: For Docker container stats.\n- `pandas`: For data handling.\n- `requests`: To fetch AWS pricing data.\n- `click`: For the command-line interface.\n\n## How It Works\n\n### Step 1: Host Machine Stats\nThe tool collects basic host machine stats, including CPU count, memory size, disk I/O, and network I/O.\n\n### Step 2: Docker Container Stats\nIt lists running Docker containers and provides real-time statistics (CPU, memory, and I/O usage) for the selected container.\n\n### Step 3: AWS Pricing Data\nResourceFit fetches EC2 and EBS pricing data from AWS for both Linux and Windows instances in the specified region.\n\n### Step 4: EC2 Instance Recommendations\nBased on the Docker container stats, ResourceFit recommends the top EC2 instances, applying a 50% memory buffer for peak loads. It also factors in disk space requirements for instances with EBS storage.\n\n## Customization\n\n### Memory Buffer Factor\nThe default memory buffer factor is set to 1.5 (50% more memory). This can be adjusted in the source code based on your needs.\n\n### AWS Region\nBy default, the AWS region is set to 'US East (N. Virginia)', but this can be modified in the code to support different regions.\n\n## License\n\nThis project is licensed under the MIT License. See the [LICENSE](LICENSE) file for details.\n\n## Contributing\n\nContributions are welcome! Please feel free to submit pull requests or open issues if you encounter any bugs or have feature requests.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojimba01%2Fresourcefit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fojimba01%2Fresourcefit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fojimba01%2Fresourcefit/lists"}