{"id":15351839,"url":"https://github.com/grkvlt/ec2cleanup","last_synced_at":"2025-04-15T04:33:52.619Z","repository":{"id":7351581,"uuid":"8675621","full_name":"grkvlt/ec2cleanup","owner":"grkvlt","description":"Utility to clean up AWS EC2 security groups and keypairs","archived":false,"fork":false,"pushed_at":"2015-08-28T14:08:28.000Z","size":190,"stargazers_count":9,"open_issues_count":0,"forks_count":3,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-28T16:04:33.607Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/grkvlt.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-03-09T20:23:42.000Z","updated_at":"2024-11-16T07:06:05.000Z","dependencies_parsed_at":"2022-09-21T12:50:27.103Z","dependency_job_id":null,"html_url":"https://github.com/grkvlt/ec2cleanup","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grkvlt%2Fec2cleanup","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grkvlt%2Fec2cleanup/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grkvlt%2Fec2cleanup/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/grkvlt%2Fec2cleanup/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/grkvlt","download_url":"https://codeload.github.com/grkvlt/ec2cleanup/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249006946,"owners_count":21197373,"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":[],"created_at":"2024-10-01T12:07:42.178Z","updated_at":"2025-04-15T04:33:52.593Z","avatar_url":"https://github.com/grkvlt.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"EC2 CleanUp\n===========\n\nUtility to clean up AWS EC2 security groups, keypairs and EBS volumes.\n\n- http://abstractvisitorpattern.co.uk/2013/03/tidying-up-after-jclouds.html\n\n## About\n\nRemoves any unused objects in an EC2 region whose names match a regular expression.\n\nThis is particularly useful for cleaning up groups and keys created by jclouds, which have names like `jclouds#0eca9048cc1e47659736c236fbbdb6c2` or `jclouds#03230716fff7412cb7241c78de86e99d#eu-west-1`. These may not be deleted when a program exits, and can accumulate and cause problems with the AWS rate-limit checks. The EC2 management console can show the number of objects in a particular region, using the links below:\n\n- [KeyPairs](https://console.aws.amazon.com/ec2/home?region=eu-west-1#s=KeyPairs)\n- [SecurityGroups](https://console.aws.amazon.com/ec2/home?region=eu-west-1#s=SecurityGroups)\n- [Volumes](https://console.aws.amazon.com/ec2/home?region=eu-west-1#s=Volumes)\n\n## Usage\n\nFirst either download or build the Jar file that will be executed.\n\n### Downloading\n\nDownload the [latest release](http://github.com/grkvlt/ec2cleanup/releases/latest/) (currently version 0.1.0) from GitHub:\n\n    % wget --no-check-certificate --quiet \\\n        -O ec2cleanup-0.1.0-jar-with-dependencies.jar \\\n        https://git.io/GuC7vw\n\nThis will download an executable Jar file named `ec2cleanup-0.1.0-jar-with-dependencies` containing the code and all required dependencies.\n\n### Building\n\nClone the latest Build the program using Maven:\n\n    % git clone git@github.com:grkvlt/ec2cleanup.git\n    ...\n    % cd ec2cleanup\n    % mvn clean install\n    ...\n\nThis will create an executable Jar file named `ec2cleanup-0.2.0-SNAPSHOT-jar-with-dependencies.jar` and will download and include all the required dependencies.\n\n### Running\n\nUse the program as follows, substituting your EC2 access key and secret key for the `aws-ec2.identity` and `aws-ec2.credential` properties. If you have built the project from source, you will need to change the version number and location of the Jar file wherever it occurs. These exammples assume you have downloaded the 0.1.0 release version:\n\n    % java -Daws-ec2.identity=XXXXXXXXXXXXXXXXXXXX \\\n        -Daws-ec2.credential=XXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx \\\n        -jar ec2cleanup-0.1.0-jar-with-dependencies.jar\n    [INFO] Cleaning SecurityGroups, KeyPairs and Volumes in aws-ec2:eu-west-1 matching 'jclouds#.*'\n    [INFO] Found 1649 matching KeyPairs\n    [INFO] Deleted 1649 KeyPairs\n    [INFO] Found 1508 matching SecurityGroups\n    [INFO] Found 113 matching Volumes\n    [WARN] Error deleting SecurityGroup 'jclouds#GmqCZ6hx#eu-west-1': There are active instances using\n    security group 'jclouds#GmqCZ6hx#eu-west-1'\n    [INFO] Deleted 1507 SecurityGroups\n    [INFO] Deleted 113 Volumes\n\n**NOTE** It is not possible to delete a security group if it is being used by an active instance, but because key pairs are only needed when starting an instance they can always be deleted. Volumes cannot be deleted if they are attached to an instance.\n\nThe default region is Amazon Europe (`eu-west-1`) which can be changed by setting the first argument. The default regular expression is `jclouds#.*`. You can use a different regular expression by adding it as the second argument, and supplying a region name as the first argument. To delete a specific key pair or security group use the complete name as the regular expression and only that object will be deleted.\n\n    % java -Daws-ec2.identity=XXXXXXXXXXXXXXXXXXXX \\\n        -Daws-ec2.credential=XXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx \\\n        -jar ec2cleanup-0.1.0-jar-with-dependencies.jar us-east-1 jclouds#grkvlt#.*\n    [INFO] Cleaning SecurityGroups, KeyPairs and Volumes in aws-ec2:us-east-1 matching 'jclouds#grkvlt#.*'\n    ...\n\nTo check the existence of matching key-pairs and security groups _without_ deleting them, include `check` before any other arguments.\n\n    % java -Daws-ec2.identity=XXXXXXXXXXXXXXXXXXXX \\\n        -Daws-ec2.credential=XXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxxXXxx \\\n        -jar ec2cleanup-0.1.0-jar-with-dependencies.jar check us-west-1\n    [INFO] Checking SecurityGroups, KeyPairs and Volumes in aws-ec2:us-west-1 matching 'jclouds#.*'\n    [INFO] Found 761 matching KeyPairs\n    [INFO] Found 1259 matching SecurityGroups\n    [INFO] Found 5 matching Volumes\n\n**NOTE** This means you cannot delete key pairs, security groups or volumes named `check`.\n\n## License\n\nCopyright 2013-2014 by Andrew Kennedy\n\n\u003e  Licensed to the Apache Software Foundation (ASF) under one\n\u003e or more contributor license agreements.  See the NOTICE file\n\u003e distributed with this work for additional information\n\u003e regarding copyright ownership.  The ASF licenses this file\n\u003e to you under the Apache License, Version 2.0 (the\n\u003e \"License\"); you may not use this file except in compliance\n\u003e with the License.  You may obtain a copy of the License at\n\u003e \n\u003e   http://www.apache.org/licenses/LICENSE-2.0\n\u003e \n\u003e Unless required by applicable law or agreed to in writing,\n\u003e software distributed under the License is distributed on an\n\u003e \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n\u003e KIND, either express or implied.  See the License for the\n\u003e specific language governing permissions and limitations\n\u003e under the License.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrkvlt%2Fec2cleanup","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgrkvlt%2Fec2cleanup","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgrkvlt%2Fec2cleanup/lists"}