{"id":17313296,"url":"https://github.com/johntdyer/unattachedebsmanager","last_synced_at":"2025-03-27T01:22:38.252Z","repository":{"id":66702766,"uuid":"191218097","full_name":"johntdyer/unAttachedEBSManager","owner":"johntdyer","description":"Go Lambda function to managed unattched volumes to control waste","archived":false,"fork":false,"pushed_at":"2019-06-10T21:45:26.000Z","size":28,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-23T23:41:49.625Z","etag":null,"topics":["aws","aws-ec2","aws-lambda","cost-control","go","serverless"],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/johntdyer.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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":"2019-06-10T17:50:20.000Z","updated_at":"2019-06-14T15:12:10.000Z","dependencies_parsed_at":"2023-03-08T00:16:04.991Z","dependency_job_id":null,"html_url":"https://github.com/johntdyer/unAttachedEBSManager","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johntdyer%2FunAttachedEBSManager","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johntdyer%2FunAttachedEBSManager/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johntdyer%2FunAttachedEBSManager/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/johntdyer%2FunAttachedEBSManager/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/johntdyer","download_url":"https://codeload.github.com/johntdyer/unAttachedEBSManager/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245761816,"owners_count":20667974,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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","aws-ec2","aws-lambda","cost-control","go","serverless"],"created_at":"2024-10-15T12:46:25.608Z","updated_at":"2025-03-27T01:22:38.224Z","avatar_url":"https://github.com/johntdyer.png","language":"Go","readme":"# unAttachedEBSManager\nGo Lambda function to managed unattched volumes to control waste\n\n## Purpose\n\nWe had an issue were some volumes were orphaned in our accounts in various regions.  Unfortunitly these volumes added up over time and this tool was written to prevent such an occurance from happening again in the future.\n\n## Features\n\n* Adds up waste since volume was created based on us-east-1 pricing at the time of release\n* Ability to run in no-op mode\n* written in go and deployed in serverless so its 100% buzzword compliant !!\n\n### Assumptions:\n  * Since the pricing API  was difficult I assumed us-east-1 pricing for provisioned IOPS and EBS.\n\n## TODO:\n\n  * Actually pull pricing from the horrible pricing API, my gawd its horrible\n  * Cloudwatch metrics\n\n## Dependencies\n\n* serverless 1.44.1\n* serverless-pseudo-parameters plugin\n\n### Installing serverless plugin\n\n```\n npm install --save-dev serverless-pseudo-parameters\n```\n\n## Variables\n\nThere are two variables you may want to tune to set this up.\n\n* The first one is the tag we will use to determine if a volume should not be culled. If this tag is present we will skip that volume.  The value of that tag can be anything, the important part is that it is set.\n\n      `SAVE_VOLUME_TAG: \"SomeRandomTag\"`\n\n* Run application in specified log level.  Valid options are `info, warn, critical, and debug`.  The default is info level.  This config is case insensitive.\n\n      `APPLICATION_LOG_LEVEL: info`\n\n\n* Run application in no-op mode.  This will log as if it were performing actions but in real life it will skip the actual delete phase of the run\n\n      `NO_OP_MODE_TRUE: true`\n\n## Deploying\n\nSimply run make file\n\n```bash\nmake deploy\n```\n\nThen you can test via\n\n```bash\nserverless invoke -f monitor\n```\n\nThen you can view logs by running\n\n```bash\nserverless logs -f monitor\ntime=\"2019-06-10T21:21:07Z\" level=info msg=\"Application initalizing\" function=0\ntime=\"2019-06-10T21:21:07Z\" level=info msg=\"Switching to log level info\" function=0\ntime=\"2019-06-10T21:21:07Z\" level=info msg=\"No OP Mode set to false via config\" function=0\ntime=\"2019-06-10T21:21:07Z\" level=info msg=\"Using tag from environment variable\" SAVE_VOLUME_TAG=CCE_Meta_dont_delete_when_unmounted function=0\ntime=\"2019-06-10T21:21:07Z\" level=info msg=\"Application initalization completed\" function=0\nSTART RequestId: 9704baf0-32c7-48a8-b4b5-f183aa4b6f9c Version: $LATEST\ntime=\"2019-06-10T21:21:08Z\" level=info msg=\"Starting region\" Region=eu-north-1 function=handler\ntime=\"2019-06-10T21:21:08Z\" level=info msg=\"Finished region\" Region=eu-north-1 function=handler\ntime=\"2019-06-10T21:21:08Z\" level=info msg=\"Starting region\" Region=ap-south-1 function=handler\ntime=\"2019-06-10T21:21:09Z\" level=info msg=\"Finished region\" Region=ap-south-1 function=handler\ntime=\"2019-06-10T21:21:09Z\" level=info msg=\"Starting region\" Region=eu-west-3 function=handler\ntime=\"2019-06-10T21:21:09Z\" level=info msg=\"Finished region\" Region=eu-west-3 function=handler\ntime=\"2019-06-10T21:21:09Z\" level=info msg=\"Starting region\" Region=eu-west-2 function=handler\ntime=\"2019-06-10T21:21:10Z\" level=info msg=\"Finished region\" Region=eu-west-2 function=handler\ntime=\"2019-06-10T21:21:10Z\" level=info msg=\"Starting region\" Region=eu-west-1 function=handler\ntime=\"2019-06-10T21:21:10Z\" level=info msg=\"Finished region\" Region=eu-west-1 function=handler\ntime=\"2019-06-10T21:21:10Z\" level=info msg=\"Starting region\" Region=ap-northeast-2 function=handler\ntime=\"2019-06-10T21:21:11Z\" level=info msg=\"Finished region\" Region=ap-northeast-2 function=handler\ntime=\"2019-06-10T21:21:11Z\" level=info msg=\"Starting region\" Region=ap-northeast-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Finished region\" Region=ap-northeast-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Starting region\" Region=sa-east-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Finished region\" Region=sa-east-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Starting region\" Region=ca-central-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Finished region\" Region=ca-central-1 function=handler\ntime=\"2019-06-10T21:21:12Z\" level=info msg=\"Starting region\" Region=ap-southeast-1 function=handler\ntime=\"2019-06-10T21:21:13Z\" level=info msg=\"Finished region\" Region=ap-southeast-1 function=handler\ntime=\"2019-06-10T21:21:13Z\" level=info msg=\"Starting region\" Region=ap-southeast-2 function=handler\ntime=\"2019-06-10T21:21:14Z\" level=info msg=\"Finished region\" Region=ap-southeast-2 function=handler\ntime=\"2019-06-10T21:21:14Z\" level=info msg=\"Starting region\" Region=eu-central-1 function=handler\ntime=\"2019-06-10T21:21:14Z\" level=info msg=\"Finished region\" Region=eu-central-1 function=handler\ntime=\"2019-06-10T21:21:14Z\" level=info msg=\"Starting region\" Region=us-east-1 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Skipping retained\" CreateTime=\"2019-06-10 16:12:49.978 +0000 UTC\" CreateTimeHuman=\"5 hours ago\" DaysOld=0 VolumeID=vol-0ba098a83a519229f VolumeIops=300 VolumeSize=100 VolumeType=gp2 function=processVolume\ntime=\"2019-06-10T21:21:15Z\" level=warning msg=\"Deleting Volume\" CreateTime=\"2019-06-10 21:18:29.401 +0000 UTC\" CreateTimeHuman=\"3 minutes ago\" DaysOld=0 VolumeID=vol-0163026da42e5a4c0 VolumeIops=300 VolumeSize=100 VolumeType=gp2 function=deleteVolume futureSavingsPerYear=120 moneyWasted=0\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Finished region\" Region=us-east-1 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Starting region\" Region=us-east-2 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Finished region\" Region=us-east-2 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Starting region\" Region=us-west-1 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Finished region\" Region=us-west-1 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Starting region\" Region=us-west-2 function=handler\ntime=\"2019-06-10T21:21:15Z\" level=info msg=\"Finished region\" Region=us-west-2 function=handler\nEND RequestId: 9704baf0-32c7-48a8-b4b5-f183aa4b6f9c\nREPORT RequestId: 9704baf0-32c7-48a8-b4b5-f183aa4b6f9c\tDuration: 7885.41 ms\tBilled Duration: 7900 ms \tMemory Size: 1024 MB\tMax Memory Used: 54 MB\n```\n\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohntdyer%2Funattachedebsmanager","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjohntdyer%2Funattachedebsmanager","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjohntdyer%2Funattachedebsmanager/lists"}