{"id":14109692,"url":"https://github.com/snobear/ec2-retirement-bulk-fix","last_synced_at":"2025-08-01T09:31:20.983Z","repository":{"id":48479079,"uuid":"112232212","full_name":"snobear/ec2-retirement-bulk-fix","owner":"snobear","description":"A tool that lists EC2 instances scheduled for retirement and optionally stop/start all in bulk","archived":false,"fork":false,"pushed_at":"2021-07-23T15:14:51.000Z","size":8,"stargazers_count":19,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-08-14T10:15:24.698Z","etag":null,"topics":["aws","boto3","ec2","python","retirement"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/snobear.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}},"created_at":"2017-11-27T18:24:58.000Z","updated_at":"2022-11-01T23:24:17.000Z","dependencies_parsed_at":"2022-09-01T16:20:30.153Z","dependency_job_id":null,"html_url":"https://github.com/snobear/ec2-retirement-bulk-fix","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/snobear%2Fec2-retirement-bulk-fix","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snobear%2Fec2-retirement-bulk-fix/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snobear%2Fec2-retirement-bulk-fix/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/snobear%2Fec2-retirement-bulk-fix/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/snobear","download_url":"https://codeload.github.com/snobear/ec2-retirement-bulk-fix/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":228360207,"owners_count":17907873,"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","boto3","ec2","python","retirement"],"created_at":"2024-08-14T10:02:27.030Z","updated_at":"2024-12-05T19:30:44.189Z","avatar_url":"https://github.com/snobear.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"### About\n\nThis script allows you to:\n\n- List all AWS EC2 instances that are scheduled for retirement in a given region\n- Do a bulk stop and start of these instances (so that they are migrated to new hardware)\n\nYou could use this to automate handling of instance retirements. Or to make life easier if you manage many EC2 instances and thus get a ton of retirement notices at once.\n\n### Install\n\n```\ngit clone https://github.com/snobear/ec2-retirement-bulk-fix.git\ncd ec2-retirement-bulk-fix\nvirtualenv venv\nsource venv/bin/activate\npip install -r requirements.txt\n```\n\n### Usage\n\nSet your AWS access key and secret\n\n```\nexport AWS_ACCESS_KEY_ID=\"KEY-GOES-HERE\"\nexport AWS_SECRET_ACCESS_KEY=\"secret\"\n```\n\n**List instances scheduled for retirement**\n\n```\n./retired.py --region us-west-2 --list\n```\n\n**Stop and start instances scheduled for retirement**\n\nThis will stop and start all instances one at a time:\n\n```\n./retired.py --region us-west-2 --stopstart\n```\n\n**Excluding instances**\n\nYou can optionally ignore instances by name. Currently, this is hardcoded in, so anything you want to exclude by name can be added to the `exclude_names` list in this function in the script:\n\n```\ndef get_instances(region, exclude_names=['master','search']):\n```\n\nA PR would be appreciated to parameterize this :).\n\n**Help**\n\n```\n./retired.py --help\n```\n\n### About EC2 Instance Retirements\n\nOccasionally, you'll receive a notice from AWS that your EC2 instance is scheduled for retirement. Per [AWS docs](http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-retirement.html), \n\n\u003e An instance is scheduled to be retired when AWS detects irreparable failure of the underlying hardware hosting the instance. When an instance reaches its scheduled retirement date, it is stopped or terminated by AWS. If your instance root device is an Amazon EBS volume, the instance is stopped, and you can start it again at any time. Starting the stopped instance migrates it to new hardware. If your instance root device is an instance store volume, the instance is terminated, and cannot be used again.\n\n### Contributing\n\nIssues and pull requests are quite welcome.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnobear%2Fec2-retirement-bulk-fix","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsnobear%2Fec2-retirement-bulk-fix","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsnobear%2Fec2-retirement-bulk-fix/lists"}